portfolio/pages/index.tsx

160 lines
6.3 KiB
TypeScript
Raw Normal View History

import React from 'react'
2022-12-06 12:54:34 +00:00
import Head from 'next/head'
2023-01-14 19:31:05 +00:00
import {GetStaticProps} from 'next'
2023-02-14 21:40:16 +00:00
import {Card} from '@/components/ui/Card'
import {Resume} from '@/components/ui/Resume'
2022-12-06 12:54:34 +00:00
import {Container} from '@/components/Container'
import {
GitHubIcon,
LinkedInIcon,
TwitterIcon
2023-02-01 20:53:47 +00:00
} from '@/components/icons/SocialIcons'
2023-02-14 21:40:16 +00:00
import {SocialLink} from '@/components/ui/SocialLink'
import {Views} from '@/components/ui/Views'
2023-01-14 19:31:05 +00:00
import {formatDate} from '@/lib/formatDate'
2022-12-06 12:54:34 +00:00
import {generateRssFeed} from '@/lib/generateRssFeed'
2023-01-14 19:31:05 +00:00
import {generateSitemap} from '@/lib/generateSitemap'
2022-12-06 12:54:34 +00:00
import {getAllArticles} from '@/lib/getAllArticles'
2023-01-14 19:31:05 +00:00
import {Article} from 'types'
2022-12-06 12:54:34 +00:00
2023-01-14 19:31:05 +00:00
function Article(article: Article) {
2022-12-06 12:54:34 +00:00
return (
<article>
<Card>
<Card.Title href={`/writing/${article.slug}`}>
{article.title}
</Card.Title>
<p className="flex order-first space-x-1 z-10 mb-3">
<Card.Eyebrow as="time" dateTime={article.date} decorate={false}>
{formatDate(article.date)}
</Card.Eyebrow>
2023-04-11 16:48:47 +00:00
<Views
slug={article.slug}
className="text-sm text-zinc-500 dark:text-zinc-400"
shouldUpdateViews={false}
/>
</p>
</Card>
</article>
2022-12-06 12:54:34 +00:00
)
}
2023-01-14 19:31:05 +00:00
export default function Home({articles}: { articles: Article[] }) {
2022-12-06 12:54:34 +00:00
return (
<>
<Head>
<title>
Ryan Freeman - Full-stack software engineer from Dublin, Ireland.
</title>
<meta
name="description"
content="Full-stack software engineer who enjoys building cloud-native applications."
/>
<meta
property="og:url"
content={`${process.env.NEXT_PUBLIC_SITE_URL}`}
/>
<meta
property="og:type"
content="website"
/>
<meta
property="og:title"
content="Ryan Freeman - Full-stack software engineer from Dublin, Ireland."
/>
<meta
property="og:description"
content="Full-stack software engineer who enjoys building cloud-native applications."
/>
<meta
property="og:image"
2023-01-19 21:53:37 +00:00
content="/static/images/photo-of-me-og.jpg"
2022-12-06 12:54:34 +00:00
/>
<meta
name="twitter:card"
content="summary_large_image"/>
<meta
property="twitter:domain"
content="ryanfreeman.dev"/>
<meta
property="twitter:url"
content={`${process.env.NEXT_PUBLIC_SITE_URL}`}
/>
<meta
name="twitter:title"
content="Ryan Freeman - Full-stack software engineer from Dublin, Ireland."/>
<meta
name="twitter:description"
content="Full-stack software engineer who enjoys building cloud-native applications."/>
<meta
name="twitter:image"
2023-01-19 21:53:37 +00:00
content="/static/images/photo-of-me-og.jpg"
2022-12-06 12:54:34 +00:00
/>
</Head>
<Container className="mt-9">
<div className="max-w-2xl">
2023-03-28 20:32:52 +00:00
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 sm:text-5xl bg-clip-text dark:text-transparent bg-gradient-to-r from-pink-500 via-red-500 to-yellow-500">
2022-12-06 12:54:34 +00:00
Full-stack software engineer who enjoys building cloud-native applications.
</h1>
<p className="mt-6 text-base text-zinc-600 dark:text-zinc-400">
Hi. I&apos;m Ryan, a software engineer based in Dublin, Ireland. I&apos;m currently working in the
aviation industry for Aer Lingus. I am passionate about personal growth and progressing in my career. This
2023-01-16 20:37:22 +00:00
is my personal website where you can learn more about me, read articles I&apos;ve written and see projects
I&apos;ve worked on.
2022-12-06 12:54:34 +00:00
</p>
<div className="mt-6 flex gap-6">
<SocialLink
href="https://github.com/r-freeman"
2023-01-22 00:12:13 +00:00
ariaLabel="Follow on GitHub"
2022-12-06 12:54:34 +00:00
icon={GitHubIcon}
/>
<SocialLink
href="https://linkedin.com/in/r-freeman/"
2023-01-22 00:12:13 +00:00
ariaLabel="Follow on LinkedIn"
2022-12-06 12:54:34 +00:00
icon={LinkedInIcon}
/>
<SocialLink
href="https://twitter.com/freemry"
2023-01-22 00:12:13 +00:00
ariaLabel="Follow on Twitter"
2022-12-06 12:54:34 +00:00
icon={TwitterIcon}
/>
</div>
</div>
</Container>
<Container className="mt-24 md:mt-28">
<div className="mx-auto grid max-w-xl grid-cols-1 gap-y-20 lg:max-w-none lg:grid-cols-2">
2023-02-03 23:32:56 +00:00
<div className="flex flex-col gap-16 mt-6">
2023-01-14 19:31:05 +00:00
{articles.map(({slug, title, description, date}) => (
<Article
key={slug}
title={title}
description={description}
slug={slug}
date={date}
/>
2022-12-06 12:54:34 +00:00
))}
</div>
<div className="space-y-10 lg:pl-16 xl:pl-24">
<Resume/>
</div>
</div>
</Container>
</>
)
}
2023-01-14 19:31:05 +00:00
export const getStaticProps: GetStaticProps = async () => {
2022-12-06 12:54:34 +00:00
if (process.env.NODE_ENV === 'production') {
await generateRssFeed()
2023-01-14 19:31:05 +00:00
await generateSitemap()
2022-12-06 12:54:34 +00:00
}
return {
props: {
articles: (await getAllArticles())
.slice(0, 3)
2022-12-06 12:54:34 +00:00
.map(({component, ...meta}) => meta),
2023-01-14 19:31:05 +00:00
}
2022-12-06 12:54:34 +00:00
}
}