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

43 lines
1.3 KiB
TypeScript
Raw Normal View History

2022-06-10 03:21:02 +00:00
import { faCalendar, faChevronRight } from "@fortawesome/free-solid-svg-icons";
import { useDefinedContext } from "../../utils/definedContext";
import { FestaIcon } from "../extensions/FestaIcon";
import { FormFromTo } from "../form/FormFromTo";
import { EditableDateTimeLocal, EditableDateTimeLocalProps } from "./EditableDateTimeLocal";
import { EditingContext } from "./EditingContext";
type EditableEventDurationProps = {
startProps: EditableDateTimeLocalProps,
endProps: EditableDateTimeLocalProps,
}
export function EditableEventDuration({ startProps, endProps }: EditableEventDurationProps) {
const [editing,] = useDefinedContext(EditingContext)
return (
<FormFromTo
preview={!editing}
icon={
<FestaIcon icon={faCalendar} />
}
start={
<EditableDateTimeLocal
max={endProps.value ?? undefined}
{...startProps}
/>
}
connector={
<FestaIcon
icon={faChevronRight}
/>
}
end={
<EditableDateTimeLocal
min={startProps.value ?? undefined}
{...endProps}
/>
}
/>
)
}