@hrgui/classy-components
v0.1.3-alpha.1
Published
Creates React components with specified CSS classes
Downloads
4
Readme
@hrgui/classy-components
This is a forked copy of sk22/classy-components. Please see for original changes and manual.
This has a couple of additional bugfixes and additional features described below, and is under the @hrgui alias.
Installation
yarn install @hrgui/classy-components
Bugfixes
Standard function notation
const Button = classy.button('btn');
// => <button class="btn">
const PrimaryButton = classy(Button)('btn-primary');
// => <button class="btn btn-primary">
would return b t b t
previously. Now it returns btn btn-primary
Additional features
Created component can have props.className as an added class
Before:
const Button = classy.button('btn');
// => <button class="btn">
<Button className="hello"></Button>
// => <button class="hello">
After:
const Button = classy.button('btn');
// => <button class="btn">
<Button className="hello btn"></Button>
// => <button class="hello btn">
Interpolation through tagged literals w/ functions (combines features from @memphju/classed-components)
const Button = classy.button`green ${props => props.className}`
<Button className="hello btn"></Button>
// => <button class="green hello btn">