Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@charlietango/emotion-sx
Advanced tools
sx
propNormally when running emotion through Babel you can use the css
prop -
this allows you to write the tagged template or Object styling directly on the components. It's then
converted into a style and className
by Babel.
We extend this setup by adding support for @styled-system/css under
a new sx
props. This allows us to consume the theme and add responsive values with arrays. This is
done by creating a custom JSX Pragma that adds support for the sx
prop on all React elements.
const Example = () => (
<div
sx={{
color: 'red',
px: [3, 6],
}}
/>
);
Make sure @charlie-tango/babel-preset-sx-prop is installed, otherwise the
sx
prop will not do anything.
If you can't add
@charlie-tango/babel-preset-sx-prop to the
project, you can still use the sx
prop by defining a custom JSX Pragma in the React file.
Include this at the top of the file:
/** @jsx jsx */
import { jsx } from '@charlietango/emotion-sx';
This replaces the normal import * as React from 'react'
(which imports the default JSX from
React).
The library includes a <BaseCss />
Global styles file - It's built on top of
sanitize.css, with some of our settings included.
import { ThemeProvider } from '@emotion/react';
import { BaseCss, baseTheme } from '@charlietango/ui';
const App = () => (
<ThemeProvider theme={baseTheme}>
<BaseCss />
<App />
</ThemeProvider>
);
In addition to this, it also extracts a few values (if set) from the theme, and defines as global defaults.
html {
background-color: 'theme.colors.background';
color: 'theme.colors.text';
font-family: 'theme.fonts.body';
}
FAQs
JSX pragma for Emotion SX prop
The npm package @charlietango/emotion-sx receives a total of 2 weekly downloads. As such, @charlietango/emotion-sx popularity was classified as not popular.
We found that @charlietango/emotion-sx 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.