From b16302ba24db020d57d3b0898f86d66c0a7ca604 Mon Sep 17 00:00:00 2001 From: Mauro Balades Date: Thu, 15 Aug 2024 22:18:27 +0200 Subject: [PATCH] chore: Update ThemeCard component to open theme page on click --- src/app/themes/[theme]/page.tsx | 24 +++++++++++++++++ src/components/theme-card.tsx | 48 +++++++++++---------------------- src/components/theme-page.tsx | 27 +++++++++++++++++++ 3 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 src/app/themes/[theme]/page.tsx create mode 100644 src/components/theme-page.tsx diff --git a/src/app/themes/[theme]/page.tsx b/src/app/themes/[theme]/page.tsx new file mode 100644 index 0000000..2487886 --- /dev/null +++ b/src/app/themes/[theme]/page.tsx @@ -0,0 +1,24 @@ +"use client"; +import Footer from "@/components/footer"; +import { Navigation } from "@/components/navigation"; +import ThemePage from "@/components/theme-page"; +import { getThemeFromId } from "@/lib/themes"; +import { useParams } from "next/navigation"; + +export default function ThemeInfoPage() { + const params = useParams<{ theme: string }>(); + const { theme: themeID } = params; + + const theme = getThemeFromId(themeID); + if (!theme) { + return
Theme not found
; + } + + return ( +
+ +
+ {/* At the bottom of the page */} +
+ ); +} \ No newline at end of file diff --git a/src/components/theme-card.tsx b/src/components/theme-card.tsx index 085507b..42aef0f 100644 --- a/src/components/theme-card.tsx +++ b/src/components/theme-card.tsx @@ -1,6 +1,6 @@ import { ZenTheme } from "@/lib/themes"; import styled from "styled-components"; -import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "./ui/dialog"; +import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./ui/dialog"; import { Button } from "./ui/button"; const ThemeCardWrapepr = styled.div` @@ -12,37 +12,19 @@ export default function ThemeCard({ theme: ZenTheme; }) { return ( - - - - {theme.name} -
-

{theme.name}

- {theme.homepage && ( - - Visit Homepage - - )} -
-

{theme.description}

-
-
- - - {theme.name} - {theme.name} - {theme.description} -
-
- -

- You need to have Zen Browser installed to use this theme. Download -

-
-
-
-
+ { + window.open(`/themes/${theme.id}`, "_self"); + }} className="flex flex-col justify-start p-6 rounded-lg shadow-md bg-muted/50 border border-muted w-full hover:shadow-lg transition duration-300 ease-in-out hover:bg-muted/100 hover:border-blue-500 cursor-pointer select-none hover:border-blue-500 hover:shadow-lg"> + {theme.name} +
+

{theme.name}

+ {theme.homepage && ( + + Visit Homepage + + )} +
+

{theme.description}

+
); } diff --git a/src/components/theme-page.tsx b/src/components/theme-page.tsx new file mode 100644 index 0000000..c793b1b --- /dev/null +++ b/src/components/theme-page.tsx @@ -0,0 +1,27 @@ +import { ZenTheme } from "@/lib/themes"; +import { Button } from "./ui/button"; + +export default function ThemePage({ theme }: { theme: ZenTheme }) { + return ( +
+
+

{theme.name}

+

{theme.description}

+ {theme.homepage && ( + + Visit Homepage + + )} +
+ +
+
+ ); +}