From c5e332f91538c9805f893b1df6580881540ae9e4 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Wed, 25 Jan 2023 22:41:21 +0000 Subject: [PATCH] Updated project styling --- components/SocialLink.tsx | 6 ++++-- components/StarIcon.tsx | 10 ++++++++++ pages/projects.tsx | 39 ++++++++++++++++++++++++--------------- 3 files changed, 38 insertions(+), 17 deletions(-) create mode 100644 components/StarIcon.tsx diff --git a/components/SocialLink.tsx b/components/SocialLink.tsx index 02380f4..5b9fad9 100644 --- a/components/SocialLink.tsx +++ b/components/SocialLink.tsx @@ -1,15 +1,17 @@ import Link from 'next/link' import {ElementType} from 'react' +import clsx from 'clsx' type SocialLink = { href: string ariaLabel: string icon: ElementType + className?: string } -export function SocialLink({icon: Icon, href, ariaLabel}: SocialLink) { +export function SocialLink({icon: Icon, href, ariaLabel, className}: SocialLink) { return ( - + diff --git a/components/StarIcon.tsx b/components/StarIcon.tsx new file mode 100644 index 0000000..0bcfb34 --- /dev/null +++ b/components/StarIcon.tsx @@ -0,0 +1,10 @@ +import {Props} from '@/types' + +export function StarIcon(props: Props) { + return ( + + + + ) +} \ No newline at end of file diff --git a/pages/projects.tsx b/pages/projects.tsx index 1df3149..fe8f423 100644 --- a/pages/projects.tsx +++ b/pages/projects.tsx @@ -1,9 +1,9 @@ +import {GetStaticProps} from 'next' import Head from 'next/head' import {Card} from '@/components/Card' import {SimpleLayout} from '@/components/SimpleLayout' -import {GitHubIcon} from '@/components/SocialIcons' import {SocialLink} from '@/components/SocialLink' -import {GetStaticProps} from 'next' +import {StarIcon} from '@/components/StarIcon' import {getPinnedRepos} from '@/lib/github' import type {Repo} from '@/types' @@ -36,19 +36,29 @@ export default function Projects({pinnedRepos}: { pinnedRepos: Repo[] }) { > {pinnedRepos.map((repo) => ( -

+

{repo.name}

{repo.description} -

- - {`r-freeman/${repo.name}`} -

+
+

+ {repo.primaryLanguage.name} + +

+

+ {repo.stargazerCount} + +

+
))} @@ -58,11 +68,10 @@ export default function Projects({pinnedRepos}: { pinnedRepos: Repo[] }) { } export const getStaticProps: GetStaticProps = async () => { - const pinnedRepos = await getPinnedRepos() - return { props: { - pinnedRepos + pinnedRepos: (await getPinnedRepos()) + .sort((a, b) => b.stargazerCount - a.stargazerCount) } } }