Skip to content

Commit

Permalink
add most sprinkles properties to Box component
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmguo committed Nov 9, 2023
1 parent 3febd50 commit 899ba47
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 13 deletions.
63 changes: 63 additions & 0 deletions packages/libs/react-ui/src/components/Layout/Box/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,23 @@ export interface IBoxProps
extends Partial<
Pick<
Sprinkles,
| 'alignItems'
| 'backgroundColor'
| 'borderColor'
| 'borderRadius'
| 'borderStyle'
| 'borderWidth'
| 'bottom'
| 'cursor'
| 'display'
| 'flexDirection'
| 'flexGrow'
| 'flexShrink'
| 'flexWrap'
| 'height'
| 'inset'
| 'justifyContent'
| 'left'
| 'margin'
| 'marginBottom'
| 'marginLeft'
Expand All @@ -22,6 +37,7 @@ export interface IBoxProps
| 'maxWidth'
| 'minHeight'
| 'minWidth'
| 'opacity'
| 'overflow'
| 'padding'
| 'paddingBottom'
Expand All @@ -30,7 +46,12 @@ export interface IBoxProps
| 'paddingTop'
| 'paddingX'
| 'paddingY'
| 'position'
| 'right'
| 'textAlign'
| 'top'
| 'width'
| 'zIndex'
>
> {
className?: string;
Expand All @@ -42,8 +63,23 @@ export const Box = ({
as = 'div',
children,
className,
alignItems,
backgroundColor,
borderColor,
borderRadius,
borderStyle,
borderWidth,
bottom,
cursor,
display = 'block',
flexDirection,
flexGrow,
flexShrink,
flexWrap,
height,
inset,
justifyContent,
left,
margin,
marginBottom,
marginLeft,
Expand All @@ -55,6 +91,7 @@ export const Box = ({
maxWidth,
minHeight,
minWidth,
opacity,
overflow,
padding,
paddingBottom,
Expand All @@ -63,15 +100,35 @@ export const Box = ({
paddingTop,
paddingX,
paddingY,
position,
right,
textAlign,
top,
width,
zIndex,
}: IBoxProps): React.ReactElement => {
return createElement(
as,
{
className: classnames(
sprinkles({
alignItems,
backgroundColor,
borderColor,
borderRadius,
borderStyle,
borderWidth,
bottom,
cursor,
display,
flexDirection,
flexGrow,
flexShrink,
flexWrap,
height,
inset,
justifyContent,
left,
margin,
marginBottom,
marginLeft,
Expand All @@ -83,6 +140,7 @@ export const Box = ({
maxWidth,
minHeight,
minWidth,
opacity,
overflow,
padding,
paddingBottom,
Expand All @@ -91,7 +149,12 @@ export const Box = ({
paddingTop,
paddingX,
paddingY,
position,
right,
textAlign,
top,
width,
zIndex,
}),
className,
),
Expand Down
28 changes: 15 additions & 13 deletions packages/libs/react-ui/src/styles/sprinkles.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,29 @@ import { darkThemeClass, vars } from './vars.css';

const systemProperties = defineProperties({
properties: {
fontFamily: vars.fonts,
lineHeight: vars.lineHeights,
border: ['none'],
borderRadius: vars.radii,
borderWidth: vars.borderWidths,
borderStyle: ['solid', 'none'],
borderWidth: vars.borderWidths,
bottom: vars.sizes,
cursor: ['pointer', 'not-allowed'],
flex: [1],
flexGrow: [0, 1],
flexShrink: [0],
flexWrap: ['wrap', 'nowrap'],
top: vars.sizes,
bottom: vars.sizes,
fontFamily: vars.fonts,
inset: [0],
left: vars.sizes,
right: vars.sizes,
flexShrink: [0],
flexGrow: [0, 1],
zIndex: [-1, 0, 1],
border: ['none'],
lineHeight: vars.lineHeights,
listStyleType: ['none'],
objectFit: ['cover', 'contain'],
outline: ['none'],
textTransform: ['uppercase', 'lowercase', 'capitalize', 'none'],
right: vars.sizes,
textDecoration: ['underline', 'none'],
textTransform: ['uppercase', 'lowercase', 'capitalize', 'none'],
top: vars.sizes,
wordBreak: ['normal', 'keep-all', 'break-word', 'break-all'],
listStyleType: ['none'],
objectFit: ['cover', 'contain'],
zIndex: [-1, 0, 1],
},
});

Expand Down

0 comments on commit 899ba47

Please sign in to comment.