Closed siriwatknp closed 1 week ago
With a flip perspective, I am able to create the Hidden with the same API using the existing generateAtomics fn.
generateAtomics
Instead of declaring xs, … xl as conditions, I use the prop name xsUp, xsDown, xsOnly, … xlUp, xlDown, xlOnly as conditions.
xs, … xl
xsUp, xsDown, xsOnly, … xlUp, xlDown, xlOnly
In the component, it reads the runtime theme to find the breakpoint keys and compose the display atomic object:
display
// user code <Hidden smUp> // runtime atomic({ display: { smUp: 'none', // this will get the className for `smUp` } })
See packages/pigment-css-react/tests/generateAtomics.test.js
packages/pigment-css-react/tests/generateAtomics.test.js
Summary
With a flip perspective, I am able to create the Hidden with the same API using the existing
generateAtomics
fn.Instead of declaring
xs, … xl
as conditions, I use the prop namexsUp, xsDown, xsOnly, … xlUp, xlDown, xlOnly
as conditions.In the component, it reads the runtime theme to find the breakpoint keys and compose the
display
atomic object:Test
See
packages/pigment-css-react/tests/generateAtomics.test.js