From d2021a5a9c82a3dc07b52d184e41407bb8f6f756 Mon Sep 17 00:00:00 2001 From: Paul Makles Date: Thu, 27 Jul 2023 12:28:11 +0100 Subject: [PATCH] feat: various common elements incl. navigation --- components/common/ListCompactor.tsx | 33 ++++++++++++ components/common/NavigateBack.tsx | 2 +- components/common/NavigationLinks.tsx | 68 +++++++++++++++++++++++++ components/common/NavigationToolbar.tsx | 56 ++++++++++++++++++++ 4 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 components/common/ListCompactor.tsx create mode 100644 components/common/NavigationLinks.tsx create mode 100644 components/common/NavigationToolbar.tsx diff --git a/components/common/ListCompactor.tsx b/components/common/ListCompactor.tsx new file mode 100644 index 0000000..286dccb --- /dev/null +++ b/components/common/ListCompactor.tsx @@ -0,0 +1,33 @@ +"use client"; + +import { FC, useState } from "react"; +import { Button } from "../ui/button"; + +export function ListCompactor({ + data, + Component, +}: { + data: T[]; + Component: FC<{ item: T }>; +}) { + const [limit, setLimit] = useState(5); + + return ( + <> + {data.length === 0 && ( +

Empty List

+ )} + {data.slice(0, limit).map((item, index) => ( + + ))} + {limit < data.length && ( + + )} + + ); +} diff --git a/components/common/NavigateBack.tsx b/components/common/NavigateBack.tsx index b8ede47..73390c7 100644 --- a/components/common/NavigateBack.tsx +++ b/components/common/NavigateBack.tsx @@ -7,7 +7,7 @@ export function NavigateBack() { const router = useRouter(); return ( - ); diff --git a/components/common/NavigationLinks.tsx b/components/common/NavigationLinks.tsx new file mode 100644 index 0000000..32d871d --- /dev/null +++ b/components/common/NavigationLinks.tsx @@ -0,0 +1,68 @@ +import Link from "next/link"; +import { buttonVariants } from "../ui/button"; +import { + Eye, + Globe2, + Home, + ScrollText, + Search, + Siren, + Sparkles, + TrendingUp, +} from "lucide-react"; + +export function NavigationLinks() { + return ( + <> + + + + + + + + + + + + + + + + + + + + + + + + + + ); +} diff --git a/components/common/NavigationToolbar.tsx b/components/common/NavigationToolbar.tsx new file mode 100644 index 0000000..6d8d0cf --- /dev/null +++ b/components/common/NavigationToolbar.tsx @@ -0,0 +1,56 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { Button } from "../ui/button"; +import { ArrowLeft, Star } from "lucide-react"; +import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover"; +import { Label } from "../ui/label"; +import { Input } from "../ui/input"; + +export function NavigationToolbar({ children }: { children: string }) { + const router = useRouter(); + const savedAsBookmark = false; + + return ( +
+ + + + + + +
+
+

Bookmark

+

+ You've saved this page for later. +

+
+
+
+ + +
+ {savedAsBookmark ? ( + <> + + + + ) : ( + + )} +
+
+
+
+

{children}

+
+ ); +}