Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
classed-components
Advanced tools
Like styled-components but for classes. Quickly create components based on CSS classes.
Like styled-components but for classes.
When using CSS Frameworks such as MaterializeCSS it is nice to create components out of existing classes from that framework.
classed-components helps you do that in a convenient way.
Plus, it just comes at 4.26kB
and has no dependencies!
npm i --save classed-components
import classed from 'classed-components'
const Header = classed.div`
header
green
`
const App = props => {
return <Header />
}
import classed from 'classed-components'
const Header = classed.div`
header
green
`
const HeaderBlack = classed(Header)`black col s12`
You can use include or exclude certain classes based on props or other variables in the current scope. This is a feature you might know from the classnames module. Whenever an embedding/interpolition within the template string returns a boolean it is interpreted as a condition on the preceeding classname.
import classed from 'classed-components'
const large = true
const MyComponent = classed.div`
header ${props => props.needsHeader}
green
large ${large}
`
import classed from 'classed-components'
const extra = 'col s12 m6'
const Header = classed.div`
${props => props.needsHeader ? 'header' : 'box'}
green
${extra}
`
Please note that adding the className prop to a classed component will overwrite its class names.
const Header = classed.div`
test-class
`
// ...
// Do not do this:
<Header className='will-overwrite-test-class' />
FAQs
CSS Classes for the component age. Apply your Css with the power of Javascript.
The npm package classed-components receives a total of 75 weekly downloads. As such, classed-components popularity was classified as not popular.
We found that classed-components demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.