Skip to content

Instantly share code, notes, and snippets.

@peduarte
Created April 19, 2021 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peduarte/21904fd858fa512e5ab7d57aa838ffc7 to your computer and use it in GitHub Desktop.
Save peduarte/21904fd858fa512e5ab7d57aa838ffc7 to your computer and use it in GitHub Desktop.
Legacy Primitives Box
import styled from 'styled-components';
import {
border,
BorderProps,
borderRadius,
BorderRadiusProps,
boxShadow,
BoxShadowProps,
backgroundColor,
BackgroundColorProps,
display,
DisplayProps,
opacity,
OpacityProps,
height,
HeightProps,
justifySelf,
JustifySelfProps,
margin,
MarginProps,
maxWidth,
MaxWidthProps,
maxHeight,
MaxHeightProps,
minHeight,
MinHeightProps,
minWidth,
MinWidthProps,
overflow,
OverflowProps,
padding,
PaddingProps,
positionSet,
PositionSetProps,
textAlign,
TextAlignProps,
textColor,
TextColorProps,
width,
WidthProps,
flexItemSet,
FlexItemSetProps,
compose,
} from '@modulz/radix-system';
export type BoxProps = BorderProps &
BorderRadiusProps &
BoxShadowProps &
BackgroundColorProps &
TextColorProps &
DisplayProps &
HeightProps &
JustifySelfProps &
MarginProps &
MaxWidthProps &
MaxHeightProps &
MinHeightProps &
MinWidthProps &
OpacityProps &
OverflowProps &
PaddingProps &
TextAlignProps &
WidthProps &
PositionSetProps &
FlexItemSetProps &
React.ComponentPropsWithRef<'div'> & { css?: any };
const styleProps = compose(
border,
borderRadius,
boxShadow,
backgroundColor,
textColor,
display,
height,
justifySelf,
margin,
maxHeight,
maxWidth,
minHeight,
minWidth,
opacity,
overflow,
padding,
textAlign,
width,
positionSet,
flexItemSet
);
export const Box = styled('div')<BoxProps>(props => props.css, styleProps);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment