From 29359f3d6938a17bece33bde92fc0be0df4b9a8a Mon Sep 17 00:00:00 2001 From: Daniel Kluge Date: Sat, 1 Oct 2022 14:04:21 +0200 Subject: [PATCH] More work on blog --- components/Blog/Card.tsx | 4 ++-- lib/content/types.ts | 1 + pages/index.tsx | 3 ++- styles/Blog/Card.module.scss | 18 +++++++++++++++++- styles/Blog/Front.module.scss | 7 +++++++ 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 styles/Blog/Front.module.scss diff --git a/components/Blog/Card.tsx b/components/Blog/Card.tsx index 05cd573..3826a3e 100644 --- a/components/Blog/Card.tsx +++ b/components/Blog/Card.tsx @@ -3,8 +3,8 @@ import styles from "../../styles/Blog/Card.module.scss"; const ProjectCard: NextPage<{ title: string, description: string }> = ({ title, description}) => { return
-
{title}
-
{description}
+

{title}

+

{description}

; }; diff --git a/lib/content/types.ts b/lib/content/types.ts index a9b087d..984a401 100644 --- a/lib/content/types.ts +++ b/lib/content/types.ts @@ -9,6 +9,7 @@ interface Content { short_desc: string; more?: string; repo?: string; + title: string; } export interface Project extends Content { diff --git a/pages/index.tsx b/pages/index.tsx index 8beb67c..5d6fef1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -5,6 +5,7 @@ import type { ContentList } from "../lib/content/types"; import Navigation from "../components/Blog/Navigation"; import ProjectCard from "../components/Blog/Card"; import Spinner from "../components/Spinner"; +import styles from "../styles/Blog/Front.module.scss"; const Blog: NextPage<{}> = () => { const { data: projectList, error } = useSWR("/content/list.json", (...args) => fetch(...args).then(res => res.json())); @@ -12,7 +13,7 @@ const Blog: NextPage<{}> = () => { const generateCards = (type: string) => { if (error) return
Error on fetching projects.
; if (!projectList) return ; - else return
{(projectList as ContentList).filter(p => p.type === type).map(p => )}
; + else return
{(projectList as ContentList).filter(p => p.type === type).map(p => )}
; }; return <> diff --git a/styles/Blog/Card.module.scss b/styles/Blog/Card.module.scss index b110966..4b61af4 100644 --- a/styles/Blog/Card.module.scss +++ b/styles/Blog/Card.module.scss @@ -1,5 +1,21 @@ .card { border: 1px solid gray; border-radius: 5px; - max-width: 200px; + max-width: 40%; + margin: 1rem auto; + transition: box-shadow 0.1s ease-in-out; + cursor: pointer; + padding: 5px; + + &:hover { + box-shadow: 0px 0px 10px blue; + } +} + +.title { + +} + +.description { + } \ No newline at end of file diff --git a/styles/Blog/Front.module.scss b/styles/Blog/Front.module.scss new file mode 100644 index 0000000..6f69e9b --- /dev/null +++ b/styles/Blog/Front.module.scss @@ -0,0 +1,7 @@ +.contentList { + display: flex; + flex-wrap: wrap; + justify-content: space-evenly; + margin: 0 -1rem; + padding: 0; +} \ No newline at end of file