Single-page photo profile with justified grid

Astro site: profile header, Flickr-style justified rows that keep each
photo's aspect ratio, and a detail page per photo (date from EXIF or a
YAML sidecar, optional location) that opens in a dialog from the grid.

Originals are dropped from the build and CI fails if a published image
still carries EXIF location or capture time. Tags release folio-<ver>.tgz
and deploy it with ygg/static-server to ig.mtps.pl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mateusz PstruchaandClaude Opus 5.5 committed 2026-10-19 20:06:20 +02:00
commit 3e18ceeb67
18 files changed
+3979

No files matched your search

+88
View File
@@ -0,0 +1,88 @@
name: Release
# v1.2.3 -> build, release folio-1.2.3.tgz, deploy/static.yml (ig.mtps.pl)
on:
push:
tags: ['v*']
jobs:
release:
runs-on: rocky-10
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Derive version
id: meta
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "$VERSION"
# Version comes from the packageManager field in package.json.
- name: Set up pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Type check
run: pnpm check
- name: Build
run: pnpm build
# Originals carry EXIF (GPS, exact time); only resized copies may ship.
- name: Check published images for EXIF
run: pnpm check:metadata
- name: Create release archive
env:
VERSION: ${{ steps.meta.outputs.version }}
run: |
NAME="${{ gitea.event.repository.name }}-${VERSION}.tgz"
# Archive the *contents* of dist/ rather than dist/ itself, so it
# untars straight into a web root.
tar -czf "$NAME" -C dist .
sha256sum "$NAME" > "$NAME.sha256"
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
server_url: ${{ gitea.server_url }}
tag_name: ${{ gitea.ref_name }}
name: ${{ gitea.ref_name }}
files: |-
${{ gitea.event.repository.name }}-*.tgz
${{ gitea.event.repository.name }}-*.tgz.sha256
# static-server on kara downloads the release asset, so this runs after it
deploy:
needs: release
runs-on: rocky-10
# never run two deploys at once
concurrency:
group: deploy-${{ gitea.repository }}
cancel-in-progress: false
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Deploy
uses: https://git.app.ygg/ygg/actions/deploy@v2
with:
type: static
dist-path: deploy/static.yml
extra-vars: |
static_release=${{ needs.release.outputs.version }}
ssh-key: ${{ secrets.DEPLOY_SSH_KEY }}
known-hosts: ${{ vars.DEPLOY_KNOWN_HOSTS }}
+5
View File
@@ -0,0 +1,5 @@
node_modules/
dist/
.astro/
*.tgz
*.tgz.sha256
+46
View File
@@ -0,0 +1,46 @@
# folio
A single-page photo profile at [ig.mtps.pl](https://ig.mtps.pl): name, bio and link on top, a justified grid of photos below, and a detail view per photo. Built with Astro, served by [static-server](https://git.app.ygg/ygg/static-server).
## Adding a photo
1. Export it to `photos/<slug>.jpg`, about 2048px on the long edge, cropped however you like (1:1, 2:3, 4:3, 16:9 all work). The slug becomes the URL: `/p/<slug>`. Starting it with the date (`2026-10-12-tatry`) keeps the folder sorted.
2. Optionally add `photos/<slug>.yml`:
```yaml
description: Sunrise over Morskie Oko # multiline works with |-
alt: Lake below a ridge at dawn # defaults to the description
taken: 2026-10-12T06:41 # defaults to EXIF DateTimeOriginal
location: # never taken from EXIF
name: Morskie Oko
lat: 49.2013 # with lon: links to OpenStreetMap
lon: 20.0712
```
3. Commit, then release: `git tag v1.2.3 && git push --follow-tags`.
Photos are ordered newest first by `taken`. Undated photos go last.
The published images are resized copies without EXIF. The build deletes the originals from `dist/`, and `pnpm check:metadata` fails the release if any image still has GPS data or a capture time.
## Profile
Edit `profile/profile.yml`. For a profile picture, put `profile/avatar.jpg` (or `.png`, `.webp`) next to it. Without one, the name's initial is shown.
## Development
```sh
pnpm install
pnpm dev # http://localhost:4321
pnpm check # types
pnpm build # dist/
pnpm check:metadata
```
## Release and deploy
Pushing a `v*` tag runs `.gitea/workflows/release.yml`:
1. It builds the site and attaches `folio-<version>.tgz` to a Gitea release.
2. It calls `ygg/actions/deploy@v2` (SSH to kara, Ansible `deploy/static`) with `deploy/static.yml`.
3. That runs static-server for this release on port 11904, behind `ig.mtps.pl`.
+41
View File
@@ -0,0 +1,41 @@
// @ts-check
import { existsSync, readdirSync, readFileSync, rmSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { defineConfig } from 'astro/config';
/**
* Astro copies the original photos into _astro/ even though pages only use
* the resized versions. The originals still carry their EXIF (GPS, camera,
* exact time), so delete every image no page references.
* @returns {import('astro').AstroIntegration}
*/
const dropUnusedOriginals = () => ({
name: 'drop-unused-originals',
hooks: {
'astro:build:done': ({ dir, pages, logger }) => {
const root = fileURLToPath(dir);
if (!existsSync(`${root}_astro`)) return;
const html = pages
.map(({ pathname }) => {
const page = pathname === '' ? 'index' : pathname.replace(/\/$/, '');
return readFileSync(`${root}${page}.html`, 'utf8');
})
.join('\n');
for (const file of readdirSync(`${root}_astro`)) {
if (/\.(jpe?g|png|webp|avif)$/i.test(file) && !html.includes(`/_astro/${file}`)) {
rmSync(`${root}_astro/${file}`);
logger.info(`removed unreferenced ${file}`);
}
}
},
},
});
export default defineConfig({
site: 'https://ig.mtps.pl',
// p/<slug>.html instead of p/<slug>/index.html: static-server's nginx
// serves $uri.html, so /p/<slug> works without a trailing-slash redirect
build: { format: 'file' },
trailingSlash: 'never',
integrations: [dropUnusedOriginals()],
});
+36
View File
@@ -0,0 +1,36 @@
---
# Static site: https://git.app.ygg/mtps/folio
#
# Deployed by .gitea/workflows/release.yml through ygg/actions/deploy
# (deploy/static playbook on kara).
#
# static_release is passed by the release workflow (-e static_release=1.2.3).
# For a manual run pass it the same way, there's deliberately no default here.
# Release assets are versioned (folio-<version>.tgz), and static-server only
# auto-detects *.tar.gz, so the asset is named explicitly.
static_stack_name: folio
domain: ig.mtps.pl
# /etc/nginx/certs/<cert>.conf on the nginx host
cert: mtps.pl
# static_service replaces the role default as a whole, so every key is required
static_service:
name: static
image: "{{ gitea_host }}/ygg/static-server:latest"
environment:
GITEA_REPOSITORY_URL: "https://{{ gitea_host }}/mtps/folio"
GITEA_RELEASE: "v{{ static_release }}"
GITEA_ASSET_NAME: "folio-{{ static_release }}.tgz"
SSL_CERT_FILE: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
volumes:
- /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem:ro
ports:
- target: 8080
published: 11904
protocol: tcp
mode: ingress
replicas: 3
restart_policy:
condition: on-failure
+25
View File
@@ -0,0 +1,25 @@
{
"name": "folio",
"version": "0.1.0",
"private": true,
"type": "module",
"packageManager": "pnpm@11.28.5",
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"check": "astro check",
"check:metadata": "node scripts/check-metadata.mjs"
},
"dependencies": {
"astro": "7.3.8",
"exifr": "7.1.3",
"sharp": "0.35.5",
"yaml": "2.9.1"
},
"devDependencies": {
"@astrojs/check": "0.9.10",
"@types/node": "^24.19.2",
"typescript": "^6.0.3"
}
}
View File
Whitespace-only changes.
+3066
View File
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
# Shown at the top of the page. Drop avatar.jpg (or .png/.webp) next to
# this file for a profile picture; without one the initial is shown.
name: mtps
bio: Photos I'm happy with.
link:
url: https://www.mtps.pl
label: mtps.pl
+17
View File
@@ -0,0 +1,17 @@
// Fails if any image in dist/ still carries EXIF location or capture time.
// Runs after the build in CI, so a leaking original never gets released.
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import exifr from 'exifr';
const dir = new URL('../dist/_astro/', import.meta.url);
const leaking = [];
for (const file of (existsSync(dir) ? readdirSync(dir) : []).filter((f) => /\.(jpe?g|png|webp|avif)$/i.test(f))) {
// exifr chokes on file paths under Node 26, a buffer works
const exif = await exifr.parse(readFileSync(new URL(file, dir)), true).catch(() => undefined);
if (exif?.latitude !== undefined || exif?.GPSLatitude || exif?.DateTimeOriginal) leaking.push(file);
}
if (leaking.length) {
console.error(`images with EXIF location/time in dist/_astro:\n ${leaking.join('\n ')}`);
process.exit(1);
}
console.log('no EXIF location/time in published images');
+67
View File
@@ -0,0 +1,67 @@
---
import { Picture } from 'astro:assets';
import { formatDate, isoLocal, type Photo } from '../lib/photos';
import { profile } from '../lib/profile';
interface Props {
photo: Photo;
newer?: Photo;
older?: Photo;
}
const { photo, newer, older } = Astro.props;
const { location } = photo;
const osm =
location?.lat !== undefined &&
`https://www.openstreetmap.org/?mlat=${location.lat}&mlon=${location.lon}#map=14/${location.lat}/${location.lon}`;
---
<article class="detail" data-slug={photo.slug}>
<div class="frame">
<Picture
src={photo.image}
alt={photo.alt}
widths={[800, 1200, 2048]}
sizes="(max-width: 900px) 100vw, calc(100vw - 360px)"
formats={['avif', 'webp']}
loading="eager"
style={`--r: ${photo.ratio.toFixed(4)}`}
/>
</div>
<aside>
<a class="who" href="/">{profile.name}</a>
{photo.description && <p class="description">{photo.description}</p>}
<dl>
{
photo.taken && (
<>
<dt>Taken</dt>
<dd>
<time datetime={isoLocal(photo.taken)}>{formatDate(photo.taken)}</time>
</dd>
</>
)
}
{
location && (
<>
<dt>Location</dt>
<dd>
{osm ? (
<a href={osm} rel="noopener" target="_blank">
{location.name ?? `${location.lat}, ${location.lon}`}
</a>
) : (
location.name
)}
</dd>
</>
)
}
</dl>
<nav>
{newer ? <a rel="prev" href={`/p/${newer.slug}`}>← Newer</a> : <span />}
{older && <a rel="next" href={`/p/${older.slug}`}>Older →</a>}
</nav>
</aside>
</article>
+69
View File
@@ -0,0 +1,69 @@
---
import { profile } from '../lib/profile';
import '../styles/detail.css';
interface Props {
title?: string;
description?: string;
}
const { title, description = profile.bio } = Astro.props;
---
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{title ? `${title} · ${profile.name}` : profile.name}</title>
{description && <meta name="description" content={description} />}
<link rel="icon" href="data:," />
</head>
<body>
<slot />
</body>
</html>
<style is:global>
:root {
--bg: #fff;
--fg: #111;
--muted: #737373;
--line: #dbdbdb;
--tile: #efefef;
--link: #00376b;
--backdrop: rgb(0 0 0 / 0.85);
color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #000;
--fg: #f5f5f5;
--muted: #a8a8a8;
--line: #262626;
--tile: #1a1a1a;
--link: #e0f1ff;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
background: var(--bg);
color: var(--fg);
font:
15px/1.45 system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
}
a {
color: inherit;
}
img {
display: block;
}
</style>
+103
View File
@@ -0,0 +1,103 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import type { ImageMetadata } from 'astro';
import { z } from 'astro/zod';
import exifr from 'exifr';
import { parse } from 'yaml';
// photos/<slug>.jpg plus an optional photos/<slug>.yml sidecar
const images = import.meta.glob<ImageMetadata>('/photos/*.{jpg,jpeg,png,webp,avif}', {
eager: true,
import: 'default',
});
const sidecars = import.meta.glob<string>('/photos/*.{yml,yaml}', {
eager: true,
query: '?raw',
import: 'default',
});
const Sidecar = z
.object({
description: z.string().optional(),
// alt text for the image, falls back to the description
alt: z.string().optional(),
// local time, e.g. 2026-10-12T06:41; overrides EXIF DateTimeOriginal
taken: z.coerce.string().optional(),
// never read from EXIF, so a location is only shown when written here
location: z
.object({
name: z.string().optional(),
lat: z.number().min(-90).max(90).optional(),
lon: z.number().min(-180).max(180).optional(),
})
.strict()
.refine((l) => (l.lat === undefined) === (l.lon === undefined), 'lat and lon go together')
.optional(),
})
.strict();
export type Photo = {
slug: string;
image: ImageMetadata;
ratio: number;
description?: string;
alt: string;
taken?: Date;
location?: z.infer<typeof Sidecar>['location'];
};
const slugOf = (path: string) => path.replace(/^.*\//, '').replace(/\.[^.]+$/, '');
async function load(path: string, image: ImageMetadata): Promise<Photo> {
const slug = slugOf(path);
const sidecarPath = Object.keys(sidecars).find((p) => slugOf(p) === slug);
let meta: z.infer<typeof Sidecar> = {};
if (sidecarPath) {
const result = Sidecar.safeParse(parse(sidecars[sidecarPath]) ?? {});
if (!result.success) throw new Error(`${sidecarPath}: ${result.error.message}`);
meta = result.data;
}
// EXIF dates have no zone; exifr and the date formatting both use the
// build machine's local zone, so the wall-clock time comes out unchanged
let taken = meta.taken ? new Date(meta.taken) : undefined;
if (taken && Number.isNaN(taken.getTime())) throw new Error(`${sidecarPath}: invalid taken`);
if (!taken) {
const exif = await exifr
.parse(readFileSync(join(process.cwd(), path)), ['DateTimeOriginal', 'CreateDate'])
.catch(() => undefined);
taken = exif?.DateTimeOriginal ?? exif?.CreateDate;
}
return {
slug,
image,
ratio: image.width / image.height,
description: meta.description,
alt: meta.alt ?? meta.description ?? '',
taken,
location: meta.location,
};
}
let cache: Promise<Photo[]> | undefined;
/** All photos, newest first; undated ones last, by name. */
export function getPhotos(): Promise<Photo[]> {
cache ??= Promise.all(Object.entries(images).map(([path, image]) => load(path, image))).then(
(photos) =>
photos.sort(
(a, b) =>
(b.taken?.getTime() ?? -Infinity) - (a.taken?.getTime() ?? -Infinity) ||
a.slug.localeCompare(b.slug),
),
);
return cache;
}
export const formatDate = (date: Date) =>
date.toLocaleString('en-GB', { dateStyle: 'long', timeStyle: 'short' });
// local wall-clock time for <time datetime>, no zone (same as the EXIF value)
export const isoLocal = (date: Date) =>
new Date(date.getTime() - date.getTimezoneOffset() * 60_000).toISOString().slice(0, 16);
+22
View File
@@ -0,0 +1,22 @@
import type { ImageMetadata } from 'astro';
import { z } from 'astro/zod';
import { parse } from 'yaml';
import raw from '../../profile/profile.yml?raw';
const avatars = import.meta.glob<ImageMetadata>('/profile/avatar.{jpg,jpeg,png,webp,avif}', {
eager: true,
import: 'default',
});
const Profile = z
.object({
name: z.string(),
bio: z.string().optional(),
link: z.object({ url: z.url(), label: z.string().optional() }).strict().optional(),
})
.strict();
const result = Profile.safeParse(parse(raw));
if (!result.success) throw new Error(`profile/profile.yml: ${result.error.message}`);
export const profile = { ...result.data, avatar: Object.values(avatars)[0] };
+259
View File
@@ -0,0 +1,259 @@
---
import { Image, Picture } from 'astro:assets';
import Base from '../layouts/Base.astro';
import { getPhotos } from '../lib/photos';
import { profile } from '../lib/profile';
const photos = await getPhotos();
---
<Base>
<header>
{
profile.avatar ? (
<Image class="avatar" src={profile.avatar} alt="" width={300} height={300} loading="eager" />
) : (
<div class="avatar" aria-hidden="true">
{profile.name.charAt(0).toUpperCase()}
</div>
)
}
<div class="about">
<h1>{profile.name}</h1>
<p class="count">{photos.length} {photos.length === 1 ? 'photo' : 'photos'}</p>
{profile.bio && <p class="bio">{profile.bio}</p>}
{
profile.link && (
<a class="link" href={profile.link.url} rel="me noopener">
{profile.link.label ?? profile.link.url.replace(/^https?:\/\//, '')}
</a>
)
}
</div>
</header>
<main class="grid">
{
photos.map((photo, i) => (
// justified rows: flex-grow and base width both scale with the aspect
// ratio, so every tile in a row ends up the same height
<a
class="tile"
href={`/p/${photo.slug}`}
style={`--r: ${photo.ratio.toFixed(4)}; flex-grow: ${Math.round(photo.ratio * 1000)}`}
>
<Picture
src={photo.image}
alt={photo.alt}
widths={[400, 800, 1200]}
sizes="(max-width: 600px) 60vw, 40vw"
formats={['avif', 'webp']}
loading={i < 6 ? 'eager' : 'lazy'}
/>
</a>
))
}
</main>
<dialog aria-label="Photo">
<button class="close" type="button" aria-label="Close">×</button>
<div class="dialog-body"></div>
</dialog>
</Base>
<style>
header {
display: flex;
align-items: center;
gap: clamp(24px, 8vw, 96px);
max-width: 935px;
margin: 0 auto;
padding: 32px 20px 40px;
}
.avatar {
flex: none;
width: clamp(77px, 20vw, 150px);
aspect-ratio: 1;
border-radius: 50%;
object-fit: cover;
background: var(--tile);
display: grid;
place-items: center;
font-size: clamp(32px, 8vw, 64px);
color: var(--muted);
}
h1 {
margin: 0;
font-size: 20px;
font-weight: 400;
}
.count {
margin: 8px 0 16px;
}
.bio {
margin: 0;
white-space: pre-line;
}
.link {
color: var(--link);
font-weight: 600;
text-decoration: none;
}
.count,
.bio,
.link {
font-size: 14px;
}
.grid {
--row: 280px;
display: flex;
flex-wrap: wrap;
gap: 3px;
max-width: 1280px;
margin: 0 auto;
padding: 0 0 48px;
border-top: 1px solid var(--line);
padding-top: 3px;
}
/* soaks up the leftover width so the last row isn't stretched */
.grid::after {
content: '';
flex-grow: 1000000;
}
.tile {
width: calc(var(--r) * var(--row));
aspect-ratio: var(--r);
background: var(--tile);
}
.tile :global(img) {
width: 100%;
height: 100%;
object-fit: cover;
}
.tile:hover :global(img) {
opacity: 0.9;
}
@media (max-width: 600px) {
header {
padding: 20px 16px 24px;
}
.grid {
--row: 140px;
}
}
dialog {
width: fit-content;
max-width: calc(100vw - 96px);
max-height: 92vh;
padding: 0;
border: 0;
background: transparent;
overflow: visible;
}
dialog::backdrop {
background: var(--backdrop);
}
.dialog-body {
overflow: hidden;
}
.close {
position: fixed;
top: 8px;
right: 16px;
border: 0;
background: none;
color: #fff;
font-size: 36px;
line-height: 1;
cursor: pointer;
}
@media (max-width: 900px) {
dialog {
width: 100vw;
max-width: none;
max-height: 100vh;
margin: 0;
height: 100%;
}
.dialog-body {
overflow: auto;
height: 100%;
background: var(--bg);
padding-top: 48px;
}
.close {
color: var(--fg);
}
}
</style>
<script>
// Progressive enhancement: tiles link to /p/<slug>; with JS that page's
// .detail is shown in a dialog instead, keeping the URL in sync.
const dialog = document.querySelector('dialog')!;
const body = dialog.querySelector('.dialog-body')!;
const pages = new Map<string, Promise<string>>();
const baseTitle = document.title;
async function show(href: string, mode: 'push' | 'replace' | 'none') {
let page = pages.get(href);
if (!page) {
page = fetch(href).then((r) => (r.ok ? r.text() : Promise.reject(r)));
pages.set(href, page);
}
let doc: Document;
try {
doc = new DOMParser().parseFromString(await page, 'text/html');
} catch {
location.href = href;
return;
}
const detail = doc.querySelector('.detail');
if (!detail) return void (location.href = href);
body.replaceChildren(document.adoptNode(detail));
body.scrollTop = 0;
document.title = doc.title;
if (mode === 'push') history.pushState({ photo: href }, '', href);
if (mode === 'replace') history.replaceState({ photo: href }, '', href);
if (!dialog.open) dialog.showModal();
}
function step(rel: 'prev' | 'next') {
const a = body.querySelector<HTMLAnchorElement>(`a[rel="${rel}"]`);
if (a) show(a.pathname, 'replace');
}
document.querySelector<HTMLElement>('.grid')!.addEventListener('click', (e) => {
const a = (e.target as Element).closest<HTMLAnchorElement>('a.tile');
if (!a || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0) return;
e.preventDefault();
show(a.pathname, 'push');
});
body.addEventListener('click', (e) => {
const a = (e.target as Element).closest<HTMLAnchorElement>('a');
if (!a || a.origin !== location.origin) return;
e.preventDefault();
if (a.rel === 'prev' || a.rel === 'next') step(a.rel);
else dialog.close();
});
dialog.querySelector('.close')!.addEventListener('click', () => dialog.close());
// a click on the backdrop lands on the dialog element itself
dialog.addEventListener('click', (e) => e.target === dialog && dialog.close());
dialog.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft') step('prev');
if (e.key === 'ArrowRight') step('next');
});
dialog.addEventListener('close', () => {
document.title = baseTitle;
if (history.state?.photo) history.back();
});
addEventListener('popstate', () => {
if (history.state?.photo) show(history.state.photo, 'none');
else if (dialog.open) dialog.close();
});
</script>
+47
View File
@@ -0,0 +1,47 @@
---
import PhotoDetail from '../../components/PhotoDetail.astro';
import Base from '../../layouts/Base.astro';
import { getPhotos, type Photo } from '../../lib/photos';
import { profile } from '../../lib/profile';
export async function getStaticPaths() {
const photos = await getPhotos();
return photos.map((photo, i) => ({
params: { slug: photo.slug },
props: { photo, newer: photos[i - 1], older: photos[i + 1] },
}));
}
interface Props {
photo: Photo;
newer?: Photo;
older?: Photo;
}
const { photo, newer, older } = Astro.props;
---
<Base title={photo.description ?? 'Photo'} description={photo.description}>
<header>
<a href="/">← {profile.name}</a>
</header>
<main>
<PhotoDetail photo={photo} newer={newer} older={older} />
</main>
</Base>
<style>
header {
max-width: 1200px;
margin: 0 auto;
padding: 12px 16px;
}
header a {
text-decoration: none;
font-weight: 600;
}
main {
width: fit-content;
margin: 0 auto 32px;
border: 1px solid var(--line);
}
</style>
+73
View File
@@ -0,0 +1,73 @@
/* PhotoDetail, also shown in the index page dialog, so loaded on every page by Base.astro */
.detail {
--meta: 340px;
display: grid;
grid-template-columns: auto var(--meta);
width: fit-content;
background: var(--bg);
}
.detail .frame {
display: grid;
place-items: center;
background: #000;
}
/* fit the viewport by aspect ratio (--r on the img), so the panel hugs the
photo whatever its shape, already before the file has loaded */
.detail .frame img {
width: min(calc(100vw - 96px - var(--meta)), calc(92vh * var(--r)));
height: auto;
aspect-ratio: var(--r);
}
.detail aside {
display: flex;
flex-direction: column;
gap: 12px;
padding: 16px;
border-left: 1px solid var(--line);
max-height: 92vh;
overflow: auto;
}
.detail .who {
font-weight: 600;
text-decoration: none;
}
.detail .description {
margin: 0;
white-space: pre-line;
}
.detail dl {
margin: 0;
display: grid;
grid-template-columns: auto 1fr;
gap: 4px 12px;
font-size: 13px;
}
.detail dt {
color: var(--muted);
}
.detail dd {
margin: 0;
}
.detail nav {
margin-top: auto;
display: flex;
justify-content: space-between;
font-size: 13px;
}
.detail nav a {
color: var(--link);
text-decoration: none;
}
@media (max-width: 900px) {
.detail {
grid-template-columns: 1fr;
width: auto;
}
.detail .frame img {
width: min(100vw, calc(80vh * var(--r)));
}
.detail aside {
border-left: 0;
max-height: none;
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"],
"compilerOptions": {
"types": ["node"]
}
}