portfolio/pages/index.tsx

277 lines
10 KiB
TypeScript
Raw Normal View History

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'
2022-12-06 12:54:34 +00:00
import {Card} from '@/components/Card'
2023-01-14 19:31:05 +00:00
import {Button} from '@/components/Button'
2022-12-06 12:54:34 +00:00
import {Container} from '@/components/Container'
import {
GitHubIcon,
LinkedInIcon,
TwitterIcon
} from '@/components/SocialIcons'
2023-01-21 22:59:27 +00:00
import {SocialLink} from '@/components/SocialLink'
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
type Work = {
company: string
title: string
start: {
label: string
dateTime: string
}
end: {
label: string
dateTime: string
}
}
function BriefcaseIcon(props: { className: string }) {
2022-12-06 12:54:34 +00:00
return (
<svg
viewBox="0 0 24 24"
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
aria-hidden="true"
{...props}
>
<path
d="M2.75 9.75a3 3 0 0 1 3-3h12.5a3 3 0 0 1 3 3v8.5a3 3 0 0 1-3 3H5.75a3 3 0 0 1-3-3v-8.5Z"
className="fill-zinc-100 stroke-zinc-400 dark:fill-zinc-100/10 dark:stroke-zinc-500"
/>
<path
d="M3 14.25h6.249c.484 0 .952-.002 1.316.319l.777.682a.996.996 0 0 0 1.316 0l.777-.682c.364-.32.832-.319 1.316-.319H21M8.75 6.5V4.75a2 2 0 0 1 2-2h2.5a2 2 0 0 1 2 2V6.5"
className="stroke-zinc-400 dark:stroke-zinc-500"
/>
</svg>
)
}
2023-01-14 19:31:05 +00:00
function ArrowDownIcon(props: { className: string }) {
2022-12-06 12:54:34 +00:00
return (
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true" {...props}>
<path
d="M4.75 8.75 8 12.25m0 0 3.25-3.5M8 12.25v-8.5"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
}
2023-01-14 19:31:05 +00:00
function Article(article: Article) {
2022-12-06 12:54:34 +00:00
return (
<Card as="article">
<Card.Title href={`/writing/${article.slug}`}>
{article.title}
</Card.Title>
<Card.Eyebrow as="time" dateTime={article.date} decorate={false}>
{formatDate(article.date)}
</Card.Eyebrow>
<Card.Description>{article.description}</Card.Description>
<Card.Cta>Read more</Card.Cta>
</Card>
)
}
function Resume() {
2023-01-14 19:31:05 +00:00
const work: Work[] = [
2022-12-06 12:54:34 +00:00
{
company: 'Aer Lingus',
title: 'Software engineer',
2023-01-14 19:31:05 +00:00
start: {
label: '2022',
dateTime: '2022'
},
2022-12-06 12:54:34 +00:00
end: {
label: 'present',
2023-01-14 19:31:05 +00:00
dateTime: new Date().getFullYear().toString(),
}
2022-12-06 12:54:34 +00:00
},
{
company: 'Apple',
title: 'At home advisor',
2023-01-14 19:31:05 +00:00
start: {
label: '2014',
dateTime: '2014'
},
end: {
label: '2018',
dateTime: '2018'
},
2022-12-06 12:54:34 +00:00
}
]
return (
<div className="rounded-2xl border border-zinc-100 p-6 dark:border-zinc-700/40 -mt-6">
<h2 className="flex text-sm font-semibold text-zinc-900 dark:text-zinc-100">
<BriefcaseIcon className="h-6 w-6 flex-none"/>
<span className="ml-3">Work</span>
</h2>
<ol className="mt-6 space-y-4">
{work.map((role, roleIndex) => (
<li key={roleIndex} className="flex gap-4">
<dl className="flex flex-auto flex-wrap gap-x-2">
<dt className="sr-only">Company</dt>
<dd className="w-full flex-none text-sm font-medium text-zinc-900 dark:text-zinc-100">
{role.company}
</dd>
<dt className="sr-only">Role</dt>
<dd className="text-xs text-zinc-500 dark:text-zinc-400">
{role.title}
</dd>
<dt className="sr-only">Date</dt>
<dd
className="ml-auto text-xs text-zinc-500 dark:text-zinc-400"
aria-label={`${role.start.label ?? role.start} until ${
role.end.label ?? role.end
}`}
>
<time dateTime={role.start.dateTime ?? role.start}>
{role.start.label ?? role.start}
</time>
<span aria-hidden="true"></span>
<time dateTime={role.end.dateTime ?? role.end}>
{role.end.label ?? role.end}
</time>
</dd>
</dl>
</li>
))}
</ol>
<Button href="/Ryan Freeman CV.pdf" variant="secondary" className="group mt-6 w-full">
Download CV
<ArrowDownIcon
className="h-4 w-4 stroke-zinc-400 transition group-active:stroke-zinc-600 dark:group-hover:stroke-zinc-50 dark:group-active:stroke-zinc-50"/>
</Button>
</div>
)
}
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">
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl bg-clip-text dark:text-transparent bg-gradient-to-r from-pink-500 via-red-500 to-yellow-500">
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"
aria-label="Follow on GitHub"
icon={GitHubIcon}
/>
<SocialLink
href="https://linkedin.com/in/r-freeman/"
aria-label="Follow on LinkedIn"
icon={LinkedInIcon}
/>
<SocialLink
href="https://twitter.com/freemry"
aria-label="Follow on Twitter"
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">
<div className="flex flex-col gap-16">
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())
2023-01-05 20:03:09 +00:00
.slice(0, 1)
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
}
}