From 7620d648548c9dd8f6a24a3ff3a356d425dfa80f Mon Sep 17 00:00:00 2001 From: monoid Date: Tue, 16 Apr 2024 23:22:26 +0900 Subject: [PATCH] feat: comic viewer nav --- .../src/components/gallery/DescItem.tsx | 26 ++++++++ packages/client/src/components/layout/nav.tsx | 34 +++++++++- .../client/src/components/layout/navAtom.tsx | 23 +++++++ packages/client/src/lib/atom.ts | 2 +- packages/client/src/lib/classifyTags.tsx | 33 ++++++++++ packages/client/src/page/contentInfoPage.tsx | 66 +------------------ packages/client/src/page/reader/comicPage.tsx | 31 +++++++-- 7 files changed, 146 insertions(+), 69 deletions(-) create mode 100644 packages/client/src/components/gallery/DescItem.tsx create mode 100644 packages/client/src/components/layout/navAtom.tsx create mode 100644 packages/client/src/lib/classifyTags.tsx diff --git a/packages/client/src/components/gallery/DescItem.tsx b/packages/client/src/components/gallery/DescItem.tsx new file mode 100644 index 0000000..566e889 --- /dev/null +++ b/packages/client/src/components/gallery/DescItem.tsx @@ -0,0 +1,26 @@ +import StyledLink from "@/components/gallery/StyledLink"; +import { cn } from "@/lib/utils"; + +export function DescItem({ name, children, className }: { + name: string; + className?: string; + children?: React.ReactNode; +}) { + return
+ {name} + {children} +
; +} +export function DescTagItem({ + items, name, className, +}: { + name: string; + items: string[]; + className?: string; +}) { + return + {items.length === 0 ? "N/A" : items.map( + (x) => {x} + )} + ; +} diff --git a/packages/client/src/components/layout/nav.tsx b/packages/client/src/components/layout/nav.tsx index 51fa2dd..88f1c37 100644 --- a/packages/client/src/components/layout/nav.tsx +++ b/packages/client/src/components/layout/nav.tsx @@ -1,8 +1,10 @@ import { Link } from "wouter" import { MagnifyingGlassIcon, GearIcon, ActivityLogIcon, ArchiveIcon, PersonIcon } from "@radix-ui/react-icons" -import { buttonVariants } from "@/components/ui/button.tsx" +import { Button, buttonVariants } from "@/components/ui/button.tsx" import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip.tsx" import { useLogin } from "@/state/user.ts"; +import { useNavItems } from "./navAtom"; +import { Separator } from "../ui/separator"; interface NavItemProps { icon: React.ReactNode; @@ -29,11 +31,41 @@ export function NavItem({ } +interface NavItemButtonProps { + icon: React.ReactNode; + onClick: () => void; + name: string; + className?: string; +} + +export function NavItemButton({ + icon, + onClick, + name, + className +}: NavItemButtonProps) { + return + + + + {name} + +} + export function NavList() { const loginInfo = useLogin(); + const navItems = useNavItems(); return