0.0.8 • Published 7 years ago

fela-react-helpers v0.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

fela-react-helpers · npm

API

withStyle

import React from 'react';
import PropTypes from 'prop-types';
import {withStyle} from 'fela-react-helpers';

const rule = props => ({
  color: props.color,
  backgroundColor: '#f00',
});

@withStyle(rule)
/**
 * `react-styleguidist` will like these
 */
class Button extends React.Component {
  static propTypes = {
    /** prop types just work */
    color: PropTypes.string,
  };

  static defaultProps = {
    /** and default props too */
    color: 'red',
  };

  render() {
    const {className, children} = this.props;
    return <button className={className}>{children}</button>;
  }
}

renderToPrettyString

Formats CSS from fela renderer with js-beautify.

import {renderToPrettyString} from 'fela-react-helpers/testTools';

const renderer = createRenderer();

// ...
// Usually you will render a React component here
// ...

const styles = renderToPrettyString(renderer, {indent_size: 4});
0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago