From 2d11de3432cc0a126f5d9581450e79b6ccba35ae Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Fri, 7 Oct 2022 23:36:57 +0200 Subject: [PATCH] Use Layout component --- components/Blog/Layout.tsx | 25 +++++++++++++++++++++++++ pages/blog/project/[pid].tsx | 19 +++++-------------- pages/index.tsx | 27 +++++++++------------------ 3 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 components/Blog/Layout.tsx diff --git a/components/Blog/Layout.tsx b/components/Blog/Layout.tsx new file mode 100644 index 0000000..fcede5a --- /dev/null +++ b/components/Blog/Layout.tsx @@ -0,0 +1,25 @@ +import type { NextPage } from "next"; +import Head from "next/head"; +import Navigation from "./Navigation"; + +interface ILayoutProps { + title?: string; +} + +const Layout: NextPage = ({ title, children }) => { + return <> + + {title ?? "c0ntroller.de"} + +
+
+ +
+
+ { children } +
+
+ ; +}; + +export default Layout; \ No newline at end of file diff --git a/pages/blog/project/[pid].tsx b/pages/blog/project/[pid].tsx index 0f36b95..45448b3 100644 --- a/pages/blog/project/[pid].tsx +++ b/pages/blog/project/[pid].tsx @@ -1,6 +1,5 @@ import type { GetServerSideProps, NextPage } from "next"; -import Head from "next/head"; -import Navigation from "../../../components/Blog/Navigation"; +import Layout from "../../../components/Blog/Layout"; import { generateContent } from "../../../lib/content/generateBackend"; import type { ContentList } from "../../../lib/content/types"; @@ -16,18 +15,10 @@ interface IContentRender { } const Post: NextPage<{ content: IContentRender }> = ({ content }) => { - return <> - - {content.title} - c0ntroller.de - -
-
- -
-
-
-
- ; + return +
+
+
; }; export const getServerSideProps: GetServerSideProps = async (context) => { diff --git a/pages/index.tsx b/pages/index.tsx index 3c699f7..46d459b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,12 +1,11 @@ import type { NextPage } from "next"; -import Head from "next/head"; import type { ContentList } from "../lib/content/types"; -import Navigation from "../components/Blog/Navigation"; import ProjectCard from "../components/Blog/Card"; import contentList from "../public/content/list.json"; import styles from "../styles/Blog/Front.module.scss"; +import Layout from "../components/Blog/Layout"; const Blog: NextPage<{ content: ContentList }> = ({content}) => { const generateCards = (type: string) => { @@ -14,22 +13,14 @@ const Blog: NextPage<{ content: ContentList }> = ({content}) => { }; return <> - - c0ntroller.de - -
-
- -
-
-

Hello there!

-

Miaumiau Lorem ipsum

-

Projects

- { generateCards("project") } -

Diaries

- { generateCards("diary") } -
-
+ +

Hello there!

+

Miaumiau Lorem ipsum

+

Projects

+ { generateCards("project") } +

Diaries

+ { generateCards("diary") } +
; };