From 052f42b580cd06364667a2a68d0a8b56253457b9 Mon Sep 17 00:00:00 2001 From: thomasabishop Date: Fri, 25 Jul 2025 16:01:28 +0100 Subject: [PATCH] feat: create generic page template apply to Tag and Entry template --- src/templates/Entry.tsx | 22 ++-------------------- src/templates/Page.tsx | 23 +++++++++++++++++++++++ src/templates/Tag.tsx | 28 +++++++++------------------- 3 files changed, 34 insertions(+), 39 deletions(-) create mode 100644 src/templates/Page.tsx diff --git a/src/templates/Entry.tsx b/src/templates/Entry.tsx index ebfc819..bd70fd8 100644 --- a/src/templates/Entry.tsx +++ b/src/templates/Entry.tsx @@ -1,25 +1,7 @@ import Main from "@/templates/Main" import { useParams } from "react-router" - +import Page from "./Page" export default function Entry() { const { entry } = useParams() - return ( -
-
-
-
-
-
-

- {entry?.replace(/_/g, " ")} -

-
- -
-
-
-
-
-
- ) + return {entry?.replace(/_/g, " ")}} /> } diff --git a/src/templates/Page.tsx b/src/templates/Page.tsx new file mode 100644 index 0000000..7f4bc02 --- /dev/null +++ b/src/templates/Page.tsx @@ -0,0 +1,23 @@ +import Main from "./Main" + +export default function Page({ pageTitle = null, pageBody = null, titleComponent = null }) { + return ( +
+
+
+
+
+
+

+ {titleComponent ? titleComponent : {pageTitle}} +

+
+ +
{pageBody}
+
+
+
+
+
+ ) +} diff --git a/src/templates/Tag.tsx b/src/templates/Tag.tsx index fcd5ba0..7b7fabd 100644 --- a/src/templates/Tag.tsx +++ b/src/templates/Tag.tsx @@ -1,26 +1,16 @@ import Main from "@/templates/Main" import { useParams } from "react-router" - +import Page from "./Page" export default function Tag() { const { tag } = useParams() return ( -
-
-
-
-
-
-

- Entries tagged: - {tag} -

-
- -
-
-
-
-
-
+ + Entries tagged: + {tag} + + } + /> ) }