Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
react-with-styles-interface-aphrodite
Advanced tools
Interface to use react-with-styles with Aphrodite.
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
or when you need to disable !important
:
import aphroditeInterface from 'react-with-styles-interface-aphrodite/no-important';
react-with-styles-interface-aphrodite
has built-in LTR/RTL context support. Specifically, it uses rtl-css-js to automatically flip styles (margin
, padding
, float
, textAlign
, etc.) that were written for an LTR page when your app is wrapped in react-with-direction's DirectionProvider
with direction set to DIRECTIONS.RTL
.
It accomplishes this by providing a directional create
and resolve
method. react-with-styles
automatically uses the correct create method based on the direction value set in context and then passes down the appropriate resolve
method as a prop named css
.
For instance, if you were to write your styles as follows:
import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import { withStyles, css } from 'react-with-styles';
ThemedStyleSheet.registerInterface(aphroditeInterface);
...
function MyComponent({ css }) {
return <div {...css(styles.container)}>Hello World</div>;
}
export default withStyles(() => ({
container: {
background: '#fff',
float: 'left',
},
}))(MyComponent);
The generated css for an app where you set <DirectionProvider direction={DIRECTIONS.LTR}>
at the top would look like:
.container_r5r4of {
background: #fff !important;
float: 'left' !important;
}
whereas if you had set <DirectionProvider direction={DIRECTIONS.RTL}>
, the generated css would be:
.container_kui6s4 {
background: #fff !important;
float: 'right' !important;
}
If you used an inline style instead:
import { css } from 'react-with-styles';
export default function MyComponent() {
return <div {...css({ background: '#fff', float: 'left' })}>Hello World</div>;
}
In the case where <DirectionProvider direction={DIRECTIONS.LTR}>
is wrapping your component, this would map to a style={{ background: '#fff', float: 'left' }}
on the div in question. If <DirectionProvider direction={DIRECTIONS.RTL}>
is present instead, this would simply apply style={{ background: '#fff', float: 'right' }}
to the div.
v6.0.0
react-with-styles v4.0.0
in peer deps@babel*
, airbnb-js-shims
, aphrodite
, babel-plugin-transform-replace-object-assign
, babel-preset-airbnb
, chai
, eslint*
, prop-types
, react
, react-dom
, sinon-sandbox
and drop support for node < 6object.entries
, rtl-css-js
eslint
, eslint-config-airbnb
, eslint-plugin-import
, eslint-plugin-jsx-a11y
, eslint-plugin-react
, rimraf
, safe-publish-latest
, airbnb-js-shims
FAQs
react-with-styles interface for Aphrodite
The npm package react-with-styles-interface-aphrodite receives a total of 17,619 weekly downloads. As such, react-with-styles-interface-aphrodite popularity was classified as popular.
We found that react-with-styles-interface-aphrodite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.