1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-12-23 15:14:23 +00:00
festa/components/form/FormFromTo.tsx

38 lines
852 B
TypeScript
Raw Normal View History

2022-06-07 11:41:26 +00:00
import classNames from "classnames"
2022-06-10 15:18:36 +00:00
import { HTMLProps, memo } from "react"
2022-06-06 01:15:44 +00:00
2022-06-10 15:18:36 +00:00
export type FormFromToProps = HTMLProps<HTMLDivElement> & {
2022-06-07 11:41:26 +00:00
preview: boolean,
2022-06-06 01:15:44 +00:00
}
2022-06-10 15:18:36 +00:00
export const FormFromTo = memo((props: FormFromToProps) => {
return (
<div
{...props}
className={classNames(
"form-fromto",
props.preview ? "form-fromto-preview" : null,
props.className
)}
/>
)
})
export type FormFromToPartProps = HTMLProps<HTMLDivElement> & {
part: "icon" | "start" | "connector" | "end"
}
2022-06-06 01:15:44 +00:00
2022-06-10 15:18:36 +00:00
export const FormFromToPart = memo((props: FormFromToPartProps) => {
2022-06-06 01:15:44 +00:00
return (
2022-06-10 15:18:36 +00:00
<div
{...props}
className={classNames(
`form-fromto-${props.part}`,
props.className,
)}
/>
2022-06-06 01:15:44 +00:00
)
2022-06-10 15:18:36 +00:00
})