From fd0440465c866dd66cf7efacc62522d2a833f6c1 Mon Sep 17 00:00:00 2001 From: Francesco Baldino Date: Mon, 9 Oct 2023 14:24:49 +0200 Subject: [PATCH 1/2] Added date picker and fixed menu rendering --- src/components/DatePicker.jsx | 26 +++++ src/components/HamburgerMenu.jsx | 26 ++--- src/components/OptionBar.jsx | 10 +- src/components/SettingsBar.jsx | 22 ++++ src/components/Toolbar.jsx | 16 ++- src/main.jsx | 120 ++++++++++++------- src/styles/main.scss | 194 ++++++++++++++++++++----------- 7 files changed, 278 insertions(+), 136 deletions(-) create mode 100644 src/components/DatePicker.jsx create mode 100644 src/components/SettingsBar.jsx 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 (