diff options
Diffstat (limited to 'components/Box')
| -rw-r--r-- | components/Box/index.tsx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/components/Box/index.tsx b/components/Box/index.tsx new file mode 100644 index 0000000..f81fa5b --- /dev/null +++ b/components/Box/index.tsx @@ -0,0 +1,26 @@ +import { getSystemStyle, SystemProps } from '../utils/systemProps'; + +interface BoxProps extends SystemProps { + style?: React.CSSProperties; + children?: React.ReactNode; + el?: keyof React.ReactHTML; +}; + +const Box: React.FC<BoxProps> = ({ el, style, children, ...props}) => { + const systemStyle = getSystemStyle(props, style); + + let Tag = el; + + if(!el) { + Tag = 'div' as keyof React.ReactHTML; + } + + return ( + // @ts-ignore + <Tag style={systemStyle}> + { children } + </Tag> + ); +}; + +export default Box; |
