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 { CSSProperties, Ref, ReactNode } from 'react'
export function Col(props: {
children?: ReactNode
className?: string
style?: CSSProperties
ref?: Ref<HTMLDivElement>
}) {
const { children, className, style, ref } = props
export function Col(props: JSX.IntrinsicElements['div']) {
const { children, className, ...rest } = props
return (
<div className={clsx(className, 'flex flex-col')} style={style} ref={ref}>
<div className={clsx(className, 'flex flex-col')} {...rest}>
{children}
</div>
)

View File

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