diff --git a/src/pages/Horarios/index.tsx b/src/pages/Horarios/index.tsx new file mode 100644 index 0000000..6f8d4d9 --- /dev/null +++ b/src/pages/Horarios/index.tsx @@ -0,0 +1,76 @@ +import { Button } from 'components/Button'; + +import { useHorarios } from 'hooks/useHorarios'; + +export function Horarios() { + const { formikHorarios } = useHorarios(); + + function addNewScheduleItem() { + const newSchedule = [...formikHorarios.values.schedules, { week_day: '', from: '', to: '' }]; + if (newSchedule.length > 7) { + newSchedule.splice(newSchedule.length - 1, 1); + } + formikHorarios.setFieldValue('schedules', newSchedule); + } + + return ( + <> +