From 888447ac59456cc15f3c6d64575db758b8c33b36 Mon Sep 17 00:00:00 2001 From: pavanydg <113893382+pavanydg@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:17:38 +0530 Subject: [PATCH] styles: updates the home page (#93) * gives proper text color to a completed and active task * refactor: css * updated the home page * modifiend ui * made the homepage responsive * refactor: rename component * refactor: use CSS grids * refactor: styles * format: files * styles: fix gap --------- Co-authored-by: JeelRajodiya --- app/components/CertificateButton/index.tsx | 2 +- .../CommunityLinks/CommunityLinks.module.css | 6 +-- .../HomePageLinks/HomePageLinks.module.css | 8 +++ .../HomePageLinks/HomePageLinks.tsx | 40 ++++++++++++++ app/components/HomePageLinks/index.tsx | 1 + .../OutlineDrawer/OutlineDrawer.tsx | 5 +- app/page.tsx | 41 ++++++-------- app/styles/globals.css | 1 + app/styles/page.module.css | 53 +++++++------------ app/styles/theme.ts | 8 +-- lib/client-functions.ts | 8 +-- lib/contentVariables.ts | 3 +- 12 files changed, 101 insertions(+), 75 deletions(-) create mode 100644 app/components/HomePageLinks/HomePageLinks.module.css create mode 100644 app/components/HomePageLinks/HomePageLinks.tsx create mode 100644 app/components/HomePageLinks/index.tsx diff --git a/app/components/CertificateButton/index.tsx b/app/components/CertificateButton/index.tsx index 5bdd0fc..8f51a54 100644 --- a/app/components/CertificateButton/index.tsx +++ b/app/components/CertificateButton/index.tsx @@ -1 +1 @@ -export {default as default} from './CertificateButton'; \ No newline at end of file +export { default as default } from "./CertificateButton"; diff --git a/app/components/CommunityLinks/CommunityLinks.module.css b/app/components/CommunityLinks/CommunityLinks.module.css index ad1834d..b650470 100644 --- a/app/components/CommunityLinks/CommunityLinks.module.css +++ b/app/components/CommunityLinks/CommunityLinks.module.css @@ -6,12 +6,12 @@ position: relative; } .footerLink { - color: hsl(var(--primary)); + color: hsl(var(--text)); text-decoration: underline; text-underline-offset: 0.15em; - text-decoration-color: hsl(var(--primary) / 0.3); + text-decoration-color: hsl(var(--primary) / 0.5); } .footerLink:hover { - text-decoration-color: hsl(var(--primary)); + text-decoration-color: hsl(var(--text)); } diff --git a/app/components/HomePageLinks/HomePageLinks.module.css b/app/components/HomePageLinks/HomePageLinks.module.css new file mode 100644 index 0000000..df8f1f5 --- /dev/null +++ b/app/components/HomePageLinks/HomePageLinks.module.css @@ -0,0 +1,8 @@ +/* grid of 4 rows */ +.HomePageLinks { + display: grid; + grid-template-rows: repeat(4, 1fr); + gap: 8px; + column-gap: 32px; + grid-auto-flow: column; +} diff --git a/app/components/HomePageLinks/HomePageLinks.tsx b/app/components/HomePageLinks/HomePageLinks.tsx new file mode 100644 index 0000000..e42224c --- /dev/null +++ b/app/components/HomePageLinks/HomePageLinks.tsx @@ -0,0 +1,40 @@ +import { contentManager } from "@/lib/contentManager"; +import styles from "./HomePageLinks.module.css"; +import Link from "next/link"; +import { useMemo } from "react"; +import CommunityLinksStyles from "@/app/components/CommunityLinks/CommunityLinks.module.css"; + +export default function HomePageLinks() { + const outline = contentManager.getOutline(); + const totalChapters = contentManager.getTotalChapters(); + const chapterInfo: { + title: string; + link: string; + }[] = useMemo(() => { + const chapterInfo = []; + for (let i = 0; i < totalChapters; i++) { + const chapter = outline[i]; + chapterInfo.push({ + title: chapter.title, + link: contentManager.getPathWithPrefix( + chapter.steps[0].fullPath, + ) as string, + }); + } + return chapterInfo; + }, []); + + return ( +
+ {chapterInfo.map((chapter, index) => ( + + {index + 1}. {chapter.title} + + ))} +
+ ); +} diff --git a/app/components/HomePageLinks/index.tsx b/app/components/HomePageLinks/index.tsx new file mode 100644 index 0000000..9228814 --- /dev/null +++ b/app/components/HomePageLinks/index.tsx @@ -0,0 +1 @@ +export { default as default } from "./HomePageLinks"; diff --git a/app/components/OutlineDrawer/OutlineDrawer.tsx b/app/components/OutlineDrawer/OutlineDrawer.tsx index f79c83e..523c725 100644 --- a/app/components/OutlineDrawer/OutlineDrawer.tsx +++ b/app/components/OutlineDrawer/OutlineDrawer.tsx @@ -43,10 +43,9 @@ export default function OutlineDrawer({ - Outline - - + +