Files
FastUI/react/fastui/components/div.tsx
Samuel Colvin eb6147512c moving python
2023-11-12 20:15:23 +00:00

45 lines
880 B
TypeScript

import { FC } from 'react'
import { ClassName, useClassNameGenerator } from '../hooks/className'
import { FastProps, RenderChildren } from './index'
interface DivProps {
type: 'Div'
children: FastProps[]
className?: ClassName
}
interface PageProps {
type: 'Page'
children: FastProps[]
className?: ClassName
}
interface RowProps {
type: 'Row'
children: FastProps[]
className?: ClassName
}
interface ColProps {
type: 'Col'
children: FastProps[]
className?: ClassName
}
export type AllDivProps = DivProps | PageProps | RowProps | ColProps
type AllDivTypes = 'Div' | 'Page' | 'Row' | 'Col'
interface Props {
type: AllDivTypes
children: FastProps[]
className?: ClassName
}
export const DivComp: FC<Props> = (props) => (
<div className={useClassNameGenerator(props.className, props)}>
<RenderChildren children={props.children} />
</div>
)