← Public packages
@kentcdodds/photo-portfolio
A fast, photo-first portfolio site you update by chatting with your agent: galleries, about, contact, and one-step rollback.
Files
/** @jsxRuntime automatic */
/** @jsxImportSource remix/component */
import type { Action } from 'remix/router'
import { coverOf, featuredGalleries } from '../../src/domain/content.ts'
import { markdownToText } from '../../src/domain/markdown.ts'
import { canonicalUrl, loadSite } from '../data/site.ts'
import { routes } from '../routes.ts'
import { galleryCards } from '../ui/gallery-card.tsx'
import { icon } from '../ui/icons.tsx'
import { ogImage } from '../ui/og-image.ts'
import { picture } from '../ui/picture.tsx'
import { render } from '../ui/render.tsx'
export default {
async handler(context) {
const site = await loadSite(context)
const { config } = site.content
const featured = featuredGalleries(site.content)
const hero = featured[0] ? coverOf(featured[0]) : undefined
return render(
site,
{
canonical: canonicalUrl(site, routes.home.href()),
nav: 'home',
...ogImage(site, hero),
},
<>
{hero ? (
<section class="hero" aria-label="Featured photo">
{picture(site, hero, {
sizes: '100vw',
priority: true,
class: 'hero-photo',
})}
</section>
) : null}
<section class="intro wrap">
<h1>{config.tagline}</h1>
<p class="lede">{markdownToText(config.bio, 220)}</p>
<p class="actions">
<a class="button" href={routes.galleries.href()}>
View galleries {icon('arrow')}
</a>
{config.bookingUrl ? (
<a
class="button secondary"
href={config.bookingUrl}
rel="noopener"
target="_blank"
>
{icon('calendar')} {config.bookingLabel}
</a>
) : (
<a class="button secondary" href={routes.contact.index.href()}>
{icon('mail')} Get in touch
</a>
)}
</p>
</section>
<section class="wrap section" aria-labelledby="featured-heading">
<h2 id="featured-heading" class="section-title">
Featured work
</h2>
{featured.length > 0 ? (
galleryCards(site, featured)
) : (
<p class="empty">New work is on its way. Check back soon.</p>
)}
</section>
</>,
)
},
} satisfies Action<typeof routes.home>