From 86aafd0b1080b559389bb84dc113c6fa0099ebdd Mon Sep 17 00:00:00 2001 From: dcorroyer Date: Tue, 26 Nov 2024 14:19:15 +0100 Subject: [PATCH] budget UI fixes --- app/assets/components/sidebar.module.css | 4 - app/assets/components/sidebar.tsx | 15 +- .../accounts/components/account-form.tsx | 2 +- .../components/account-items.module.css | 11 -- .../accounts/components/account-items.tsx | 2 +- app/assets/features/accounts/pages/list.tsx | 4 +- .../features/auth/pages/login.module.css | 6 - app/assets/features/auth/pages/login.tsx | 4 +- .../features/auth/pages/register.module.css | 6 - app/assets/features/auth/pages/register.tsx | 4 +- .../budgets/components/budget-form.module.css | 8 + .../budgets/components/budget-form.tsx | 12 +- .../budgets/components/budget-items.tsx | 2 +- .../budget-summary-cards.module.css | 119 ++++++++++++++ .../components/budget-summary-cards.tsx | 41 +++++ .../components/budget-table.module.css | 1 + .../budgets/components/budget-table.tsx | 154 +++++++++++++----- .../features/budgets/pages/detail.module.css | 120 -------------- app/assets/features/budgets/pages/detail.tsx | 76 +++------ .../features/budgets/pages/list.module.css | 8 + app/assets/features/budgets/pages/list.tsx | 12 +- app/assets/layouts/authenticated-layout.tsx | 2 +- app/templates/base.html.twig | 6 +- 23 files changed, 346 insertions(+), 273 deletions(-) delete mode 100644 app/assets/features/accounts/components/account-items.module.css delete mode 100644 app/assets/features/auth/pages/login.module.css delete mode 100644 app/assets/features/auth/pages/register.module.css create mode 100644 app/assets/features/budgets/components/budget-summary-cards.module.css create mode 100644 app/assets/features/budgets/components/budget-summary-cards.tsx diff --git a/app/assets/components/sidebar.module.css b/app/assets/components/sidebar.module.css index 2763921..cc9097c 100644 --- a/app/assets/components/sidebar.module.css +++ b/app/assets/components/sidebar.module.css @@ -16,10 +16,6 @@ background-color: var(--mantine-color-white); /* Couleur de fond pour le mode clair */ } -.navbarMain { - flex: 1; -} - .header { padding-bottom: var(--mantine-spacing-md); margin-bottom: calc(var(--mantine-spacing-md) * 4); diff --git a/app/assets/components/sidebar.tsx b/app/assets/components/sidebar.tsx index 2bf7a62..36a65b0 100644 --- a/app/assets/components/sidebar.tsx +++ b/app/assets/components/sidebar.tsx @@ -4,7 +4,7 @@ import { Link, useLocation } from 'react-router-dom' import cx from 'clsx' -import { Group, useComputedColorScheme, useMantineColorScheme } from '@mantine/core' +import { em, Group, useComputedColorScheme, useMantineColorScheme } from '@mantine/core' import { useMediaQuery } from '@mantine/hooks' import { IconChartLine, @@ -30,10 +30,14 @@ const data = [ { icon: IconCreditCard, label: 'Accounts', path: '/accounts' }, ] -export function Sidebar() { +interface SidebarProps { + onNavigate?: () => void +} + +export function Sidebar({ onNavigate }: SidebarProps) { const { logout } = useAuth() - const isMobile = useMediaQuery('(max-width: 768px)') + const isMobile = useMediaQuery(`(max-width: ${em(750)})`) const { setColorScheme } = useMantineColorScheme() const computedColorScheme = useComputedColorScheme('light', { getInitialValueInEffect: true }) @@ -52,6 +56,9 @@ export function Sidebar() { key={item.label} onClick={() => { setActive(item.path) + if (isMobile && onNavigate) { + onNavigate() + } }} > @@ -62,7 +69,7 @@ export function Sidebar() { return (