feat(components): add Box primitive to components library #5665
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
overview
Palate cleanser PR for myself after the U2E project is officially dev complete. This PR follows up on #5637 by:
<Box>
primitive to the library<div>
with styling props to reduce CSS repetitionmargin
andpadding
marginX
,marginY
,paddingX
, andpaddingY
props to set left/right or top/bottom simultaneouslyThese components and props are, like #5637, pretty heavily inspired by theme-ui, styled-system, and rebass.
changelog
components/src/primitives/style-props.js
review requests
How does this look / feel? I replaced some inline styled-component styling logic with the new Box primitive and spacing props to demonstrate.
A really nice benefit of these primitives and styling props is that the more we can lean on them, the less reliant we are on any one particular styling solution. These primitives / props could be implemented in vanilla CSS, CSS Modules, styled-components, emotion, or whatever other thing without changing their APIs
risk assessment
Low. Mostly internal components DX work, and logic is unit-tested all the way down to the CSS