Open Brooooooklyn opened 3 years ago
BTW, node-sass
is shit.
BTW,
node-sass
is shit.
I have removed it.
const className = classnames('text-white', 'rounded', { 'bg-blue-500': type === 'primary', 'bg-blue-400': type === 'secondary', 'bg-gray-500': type === 'tertiary', 'bg-yellow-500': type === 'warning', 'bg-red-500': type === 'danger', 'py-3 px-6': size === 'default', 'py-1 px-1': size === 'small', 'py-4 px-7': size === 'large', });
The css in js way:
styled.button<{ type: ButtonType }>(({ type }) => ({ bg: BG_COLORS[type], size: SIZE[type], }))
And in this way, html props can easily pass to the
button
under the hood, and it's more i11y friendly.
CSS in JS sounds great. However, this project is based on Tailwind CSS, it prefers using classname to specify styles.
After consideration, there is no doubt that style-component is a nice way to integrate tailwind css in react component. Thanks for your suggestion.
After consideration, there is no doubt that style-component is a nice way to integrate tailwind css in react component.
I will recommend emotion
for smaller size and better runtime performance.
After consideration, there is no doubt that style-component is a nice way to integrate tailwind css in react component.
I will recommend
emotion
for smaller size and better runtime performance.
I have already used emotion
The css in js way:
And in this way, html props can easily pass to the
button
under the hood, and it's more i11y friendly.