fela-react-helpers ·
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)
class Button extends React.Component {
static propTypes = {
color: PropTypes.string,
};
static defaultProps = {
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();
const styles = renderToPrettyString(renderer, {indent_size: 4});