diff --git a/src/components/DatePicker.jsx b/src/components/DatePicker.jsx new file mode 100644 index 0000000..7242dfd --- /dev/null +++ b/src/components/DatePicker.jsx @@ -0,0 +1,26 @@ +import { useRef } from 'preact/hooks' +import { Icon } from './Icon.jsx' + +export const DatePicker = ({ date, setDate }) => { + const input = useRef() + + const [year, month, day] = date.split('T')[0].split('-') + return ( +
input.current.showPicker()}> + setDate(new Date(e.target.value).toISOString())} + /> +
+
+ {day}/{month}/{year} +
+
+ +
+
+
+ ) +} diff --git a/src/components/HamburgerMenu.jsx b/src/components/HamburgerMenu.jsx index 334bd37..eba0395 100644 --- a/src/components/HamburgerMenu.jsx +++ b/src/components/HamburgerMenu.jsx @@ -1,27 +1,17 @@ import { ComboBox } from './ComboBox.jsx' -import { MODE_COURSES, MODE_SCHEDULE, MODE_WORKWEEK, MODE_WORKWEEK_GRID } from './EventsView.jsx' +import { + MODE_COURSES, + MODE_SCHEDULE, + MODE_WORKWEEK, + MODE_WORKWEEK_GRID, +} from './EventsView.jsx' +import { DatePicker } from './DatePicker.jsx' import { Help } from './Help.jsx' import { Icon } from './Icon.jsx' -export const HamburgerMenu = ({ onClose, theme, setTheme }) => { +export const HamburgerMenu = ({ date, setDate, onClose, theme, setTheme }) => { return (