From 354d5b2b9155be06d88927149e93f79b4436966d Mon Sep 17 00:00:00 2001 From: q9i <46249765+quantum9Innovation@users.noreply.github.com> Date: Sun, 18 Feb 2024 21:01:44 -0800 Subject: [PATCH] feat: add author list page - Added a new function `generateStaticParams()` to generate static parameters for each author. - Created a new component `AuthorCard` to display information about an author. - Updated the `Page` component to render a grid of `AuthorCard` components for each author. - Added styling for the author cards using CSS modules. --- src/app/author/page.tsx | 83 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/app/author/page.tsx diff --git a/src/app/author/page.tsx b/src/app/author/page.tsx new file mode 100644 index 0000000..37c0730 --- /dev/null +++ b/src/app/author/page.tsx @@ -0,0 +1,83 @@ +import { authors, affiliations } from '@/app/db/data' +import { notFound } from 'next/navigation' +import { Zilla_Slab } from 'next/font/google' +import { Fragment } from 'react' +import Image from 'next/image' +import Link from 'next/link' +import cardEffects from '@/app/styles/cardEffects.module.css' + +const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) + +export function generateStaticParams() { + const authorsList = Object.keys(authors) + return authorsList.map((shortName) => ({ shortName })) +} + +const AuthorCard = ({ + params, +}: Readonly<{ params: { shortName: string } }>) => { + const { shortName } = params + const { name, image, affiliation } = authors[shortName] + if (!name) { + notFound() + } + + const mainAffiliationShort = affiliation[0].split('@')[1] + const mainPosition = affiliation[0].split('@')[0] + const mainAffiliation = affiliations[mainAffiliationShort] + + return ( + +
+
+ profile +
+
+ + {name.first} {name.last} + +
+ {mainPosition} at{' '} + + {mainAffiliation.name} + +
+
+ + ) +} + +const Page = () => { + return ( +
+

+ Affiliations +

+
+ {Object.keys(authors).map((authorShortName) => { + return ( + + + + ) + })} +
+
+ ) +} + +export default Page