From 698d4163147271932231743befaf3dad10b11665 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sat, 16 Mar 2024 21:33:55 +0100 Subject: [PATCH 1/3] N-FIN-34: add required shadcn/ui components --- package-lock.json | 13 ++++ package.json | 1 + src/components/ui/drawer.tsx | 118 +++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 src/components/ui/drawer.tsx diff --git a/package-lock.json b/package-lock.json index 7843c0b..f31cc7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,6 +40,7 @@ "swr": "^2.2.5", "tailwind-merge": "^2.2.1", "tailwindcss-animate": "^1.0.7", + "vaul": "^0.9.0", "zod": "^3.22.4" }, "devDependencies": { @@ -6184,6 +6185,18 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "devOptional": true }, + "node_modules/vaul": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/vaul/-/vaul-0.9.0.tgz", + "integrity": "sha512-bZSySGbAHiTXmZychprnX/dE0EsSige88xtyyL3/MCRbrFotRPQZo7UdydGXZWw+CKbNOw5Ow8gwAo93/nB/Cg==", + "dependencies": { + "@radix-ui/react-dialog": "^1.0.4" + }, + "peerDependencies": { + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index 2cb23d4..5262d91 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "swr": "^2.2.5", "tailwind-merge": "^2.2.1", "tailwindcss-animate": "^1.0.7", + "vaul": "^0.9.0", "zod": "^3.22.4" }, "devDependencies": { diff --git a/src/components/ui/drawer.tsx b/src/components/ui/drawer.tsx new file mode 100644 index 0000000..8f28ade --- /dev/null +++ b/src/components/ui/drawer.tsx @@ -0,0 +1,118 @@ +'use client'; + +import * as React from 'react'; +import { Drawer as DrawerPrimitive } from 'vaul'; + +import { cn } from '@/lib/utils'; + +const Drawer = ({ + shouldScaleBackground = true, + ...props +}: React.ComponentProps) => ( + +); +Drawer.displayName = 'Drawer'; + +const DrawerTrigger = DrawerPrimitive.Trigger; + +const DrawerPortal = DrawerPrimitive.Portal; + +const DrawerClose = DrawerPrimitive.Close; + +const DrawerOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({className, ...props}, ref) => ( + +)); +DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName; + +const DrawerContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({className, children, ...props}, ref) => ( + + + +
+ {children} + + +)); +DrawerContent.displayName = 'DrawerContent'; + +const DrawerHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+); +DrawerHeader.displayName = 'DrawerHeader'; + +const DrawerFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+); +DrawerFooter.displayName = 'DrawerFooter'; + +const DrawerTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({className, ...props}, ref) => ( + +)); +DrawerTitle.displayName = DrawerPrimitive.Title.displayName; + +const DrawerDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({className, ...props}, ref) => ( + +)); +DrawerDescription.displayName = DrawerPrimitive.Description.displayName; + +export { + Drawer, + DrawerPortal, + DrawerOverlay, + DrawerTrigger, + DrawerClose, + DrawerContent, + DrawerHeader, + DrawerFooter, + DrawerTitle, + DrawerDescription, +}; From 36563db77ee9e422ed00f90adb12c20afbcceeb5 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sat, 16 Mar 2024 21:35:13 +0100 Subject: [PATCH 2/3] N-FIN-34: add new navigation variant for mobile devices --- src/components/navigation.tsx | 146 ++++++++++++++++++-------- src/components/ui/navigation-menu.tsx | 5 + 2 files changed, 108 insertions(+), 43 deletions(-) diff --git a/src/components/navigation.tsx b/src/components/navigation.tsx index c744453..f004745 100644 --- a/src/components/navigation.tsx +++ b/src/components/navigation.tsx @@ -2,65 +2,125 @@ import { NavigationMenu, + navigationMenuIconTriggerStyle, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, navigationMenuTriggerStyle, } from '@/components/ui/navigation-menu'; -import React from 'react'; +import React, { useState } from 'react'; import Link from 'next/link'; -import { User } from 'lucide-react'; +import { Banknote, Home, Menu, Tag, User, UserSearch } from 'lucide-react'; +import { Drawer, DrawerContent, DrawerTrigger } from '@/components/ui/drawer'; +import { Button } from '@/components/ui/button'; export default function Navigation() { + const [open, setOpen] = useState(false); + return (
- - -
- - Finances - - - - - Dashboard - +
+ setOpen(open)}> + + + + +
+ setOpen(false)} + passHref> + + Dashboard - - - - - Payments - + setOpen(false)} + passHref> + + Payments - - - - - Entities - + setOpen(false)} + passHref> + + Entities - - - - - Categories - + setOpen(false)} + passHref> + + Categories - -
- - - - - Account + setOpen(false)} + passHref> - - - - - + Account + +
+ + +
+
+ + +
+ + Finances + + + + + Dashboard + + + + + + + Payments + + + + + + + Entities + + + + + + + Categories + + + +
+ + + + + Account + + + + +
+
+
); } diff --git a/src/components/ui/navigation-menu.tsx b/src/components/ui/navigation-menu.tsx index 800788d..71f001a 100644 --- a/src/components/ui/navigation-menu.tsx +++ b/src/components/ui/navigation-menu.tsx @@ -44,6 +44,10 @@ const navigationMenuTriggerStyle = cva( 'group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50', ); +const navigationMenuIconTriggerStyle = cva( + 'group inline-flex h-10 w-full items-center justify-start rounded-md bg-background px-4 py-2 space-x-4 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50', +); + const NavigationMenuTrigger = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef @@ -117,6 +121,7 @@ NavigationMenuIndicator.displayName = export { navigationMenuTriggerStyle, + navigationMenuIconTriggerStyle, NavigationMenu, NavigationMenuList, NavigationMenuItem, From 7ebc05c2570a992fa133afbfac1f15086ee68eea Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sat, 16 Mar 2024 21:36:31 +0100 Subject: [PATCH 3/3] N-FIN-34: add space between title and dashboard scope selection --- src/components/dashboardPageClientComponents.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dashboardPageClientComponents.tsx b/src/components/dashboardPageClientComponents.tsx index 314fa5c..8f368da 100644 --- a/src/components/dashboardPageClientComponents.tsx +++ b/src/components/dashboardPageClientComponents.tsx @@ -49,7 +49,7 @@ export default function DashboardPageClientContent( return (
-
+

Dashboard