
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@awesomecss/reactor
Advanced tools
A simple way to include CSS with React Components.
npm install --save @awesomecss/reactor
withStyles
from Reactorimport React from 'react'
import { withStyles } from '@awesomecss/reactor'
Write your CSS styles as a string. This is default out-of-the-box CSS. Use things like :hover
, @media
queries, as you normally would!
const css = `
.Button {
background: white;
border: 1px solid #eee;
}
`
Note: You can of course use string interpolation. It's still JS after all!
Create your component as you normally would.
const Button = props => (
<button className='Button' {...props} />
)
Note: The reference the CSS className
to match the CSS you wrote. Reactor does not generated uniquely hashed classNames for you. See CSS Modules for that feature.
When exporting your component, compose it with the withStyles
higher-order component along with your CSS styles.
export default withStyles(css)(Button)
import React from 'react'
import { withStyles } from '@awesomecss/reactor'
const css = `
.Button {
background: white;
border: 1px solid #eee;
}
`
const Button = props => (
<button className='Button' {...props} />
)
export default withStyles(css)(Button)
<html>
<head>
<style type='text/css'>
.Button {
background: white;
border: 1px solid #eee;
}
</style>
</head>
<body>
...
<button class='Button'>Button</button>
...
</body>
</html>
That's it! You're done 🙌. You've created a CSS-ready component.
You can define dynamic styles by passing a function
into withStyles
. It will have access to a component's props
, allowing you to define custom rules for various prop
values.
const Card = props => (<div {...props} />)
const css = (props) => `
div {
background: ${props.title ? 'red' : 'blue'};
position: relative;
border: 1px solid black;
}
`
const StyledCard = withStyles(css)(Card)
This technique is similar to the ones found in Styled Components.
FAQs
A simple way to include CSS with React Components
The npm package @awesomecss/reactor receives a total of 2 weekly downloads. As such, @awesomecss/reactor popularity was classified as not popular.
We found that @awesomecss/reactor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.