refactor Row, Col to accept all div props

This commit is contained in:
Sinclair Chen 2022-05-31 17:13:54 -07:00
parent d8af8accbb
commit 3d9d60e8fe
2 changed files with 6 additions and 17 deletions

View File

@ -1,16 +1,10 @@
import clsx from 'clsx' import clsx from 'clsx'
import { CSSProperties, Ref, ReactNode } from 'react'
export function Col(props: { export function Col(props: JSX.IntrinsicElements['div']) {
children?: ReactNode const { children, className, ...rest } = props
className?: string
style?: CSSProperties
ref?: Ref<HTMLDivElement>
}) {
const { children, className, style, ref } = props
return ( return (
<div className={clsx(className, 'flex flex-col')} style={style} ref={ref}> <div className={clsx(className, 'flex flex-col')} {...rest}>
{children} {children}
</div> </div>
) )

View File

@ -1,15 +1,10 @@
import clsx from 'clsx' import clsx from 'clsx'
import { ReactNode } from 'react'
export function Row(props: { export function Row(props: JSX.IntrinsicElements['div']) {
children?: ReactNode const { children, className, ...rest } = props
className?: string
id?: string
}) {
const { children, className, id } = props
return ( return (
<div className={clsx(className, 'flex flex-row')} id={id}> <div className={clsx(className, 'flex flex-row')} {...rest}>
{children} {children}
</div> </div>
) )