Remove clutter
This commit is contained in:
parent
728dcdb3d9
commit
53ef4d9147
9 changed files with 11 additions and 16 deletions
|
|
@ -51,6 +51,7 @@
|
||||||
"immich",
|
"immich",
|
||||||
"immich's",
|
"immich's",
|
||||||
"importmap",
|
"importmap",
|
||||||
|
"incrementality",
|
||||||
"janky",
|
"janky",
|
||||||
"jemalloc",
|
"jemalloc",
|
||||||
"keepalives",
|
"keepalives",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ const textExtensions = new Set([
|
||||||
'.mjs',
|
'.mjs',
|
||||||
'.ts',
|
'.ts',
|
||||||
'.txt',
|
'.txt',
|
||||||
'.vtt',
|
|
||||||
'.webmanifest',
|
'.webmanifest',
|
||||||
'.xml',
|
'.xml',
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ const textExtensions = new Set([
|
||||||
'.mjs',
|
'.mjs',
|
||||||
'.ts',
|
'.ts',
|
||||||
'.txt',
|
'.txt',
|
||||||
'.vtt',
|
|
||||||
'.webmanifest',
|
'.webmanifest',
|
||||||
'.xml',
|
'.xml',
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ const MIME = {
|
||||||
'.woff2': 'font/woff2',
|
'.woff2': 'font/woff2',
|
||||||
'.mp4': 'video/mp4',
|
'.mp4': 'video/mp4',
|
||||||
'.webm': 'video/webm',
|
'.webm': 'video/webm',
|
||||||
'.vtt': 'text/vtt; charset=utf-8',
|
|
||||||
'.pdf': 'application/pdf',
|
'.pdf': 'application/pdf',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,18 +8,16 @@ interface Props {
|
||||||
projectPeriod?: string;
|
projectPeriod?: string;
|
||||||
stack?: string[];
|
stack?: string[];
|
||||||
scale?: string;
|
scale?: string;
|
||||||
outcome?: string;
|
|
||||||
links?: Link[];
|
links?: Link[];
|
||||||
headingId: string;
|
headingId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { projectPeriod, stack = [], scale, outcome, links = [], headingId } = Astro.props;
|
const { projectPeriod, stack = [], scale, links = [], headingId } = Astro.props;
|
||||||
|
|
||||||
const rows: Array<[string, string]> = [];
|
const rows: Array<[string, string]> = [];
|
||||||
if (projectPeriod) rows.push(['Period', projectPeriod]);
|
if (projectPeriod) rows.push(['Period', projectPeriod]);
|
||||||
if (stack.length > 0) rows.push(['Stack', stack.join(', ')]);
|
if (stack.length > 0) rows.push(['Stack', stack.join(', ')]);
|
||||||
if (scale) rows.push(['Scale', scale]);
|
if (scale) rows.push(['Scale', scale]);
|
||||||
if (outcome) rows.push(['Outcome', outcome]);
|
|
||||||
---
|
---
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ const videoHeight = item.type === 'video' ? (item.poster?.height ?? 720) : undef
|
||||||
poster={item.poster?.src}
|
poster={item.poster?.src}
|
||||||
width={videoWidth}
|
width={videoWidth}
|
||||||
height={videoHeight}
|
height={videoHeight}
|
||||||
aria-label={item.alt}
|
aria-label={item.caption}
|
||||||
>
|
>
|
||||||
{item.webm && <source src={item.webm} type="video/webm" />}
|
{item.webm && <source src={item.webm} type="video/webm" />}
|
||||||
{item.mp4 && <source src={item.mp4} type="video/mp4" />}
|
{item.mp4 && <source src={item.mp4} type="video/mp4" />}
|
||||||
|
|
@ -50,7 +50,7 @@ const videoHeight = item.type === 'video' ? (item.poster?.height ?? 720) : undef
|
||||||
item.src && (
|
item.src && (
|
||||||
<Picture
|
<Picture
|
||||||
src={item.src}
|
src={item.src}
|
||||||
alt={item.decorative ? '' : (item.alt ?? '')}
|
alt={item.decorative ? '' : (item.caption ?? '')}
|
||||||
formats={['avif', 'webp']}
|
formats={['avif', 'webp']}
|
||||||
widths={[480, 960, 1280, 1920]}
|
widths={[480, 960, 1280, 1920]}
|
||||||
sizes="(max-width: 700px) calc(100vw - 2 * clamp(20px, 4vw, 32px)), (max-width: 1100px) min(calc(100vw - 4rem), 56rem), 56rem"
|
sizes="(max-width: 700px) calc(100vw - 2 * clamp(20px, 4vw, 32px)), (max-width: 1100px) min(calc(100vw - 4rem), 56rem), 56rem"
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ const playScript = `
|
||||||
class="video-thumbnail__play"
|
class="video-thumbnail__play"
|
||||||
type="button"
|
type="button"
|
||||||
data-video-play
|
data-video-play
|
||||||
aria-label={`Play video: ${video.alt ?? alt}`}
|
aria-label={`Play video: ${video.caption ?? alt}`}
|
||||||
>
|
>
|
||||||
<span class="video-thumbnail__play-icon" aria-hidden="true">
|
<span class="video-thumbnail__play-icon" aria-hidden="true">
|
||||||
<svg viewBox="0 0 24 24" focusable="false">
|
<svg viewBox="0 0 24 24" focusable="false">
|
||||||
|
|
@ -106,7 +106,7 @@ const playScript = `
|
||||||
preload="none"
|
preload="none"
|
||||||
playsinline
|
playsinline
|
||||||
poster={video.poster?.src}
|
poster={video.poster?.src}
|
||||||
aria-label={video.alt}
|
aria-label={video.caption}
|
||||||
hidden
|
hidden
|
||||||
>
|
>
|
||||||
{video.webm && <source src={video.webm} type="video/webm" />}
|
{video.webm && <source src={video.webm} type="video/webm" />}
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,15 @@ const thumbnailOverrideSchema = ({ image }: SchemaContext) =>
|
||||||
src: image(),
|
src: image(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The caption is the single source of truth for a media item's text: it shows
|
||||||
|
// as the visible <figcaption> and doubles as the image alt / accessible name,
|
||||||
|
// so meaningful media carries one string instead of a caption/alt pair.
|
||||||
const mediaSchema = ({ image }: SchemaContext) =>
|
const mediaSchema = ({ image }: SchemaContext) =>
|
||||||
z
|
z
|
||||||
.discriminatedUnion('type', [
|
.discriminatedUnion('type', [
|
||||||
z.object({
|
z.object({
|
||||||
type: z.enum(['image', 'diagram']),
|
type: z.enum(['image', 'diagram']),
|
||||||
src: image(),
|
src: image(),
|
||||||
alt: z.string().optional(),
|
|
||||||
decorative: z.boolean().optional(),
|
decorative: z.boolean().optional(),
|
||||||
caption: z.string().optional(),
|
caption: z.string().optional(),
|
||||||
transcript: z.string().optional(),
|
transcript: z.string().optional(),
|
||||||
|
|
@ -89,7 +91,6 @@ const mediaSchema = ({ image }: SchemaContext) =>
|
||||||
poster: image().optional(),
|
poster: image().optional(),
|
||||||
mp4: mediaUrl.optional(),
|
mp4: mediaUrl.optional(),
|
||||||
webm: mediaUrl.optional(),
|
webm: mediaUrl.optional(),
|
||||||
alt: z.string().optional(),
|
|
||||||
decorative: z.boolean().optional(),
|
decorative: z.boolean().optional(),
|
||||||
caption: z.string().optional(),
|
caption: z.string().optional(),
|
||||||
transcript: z.string().optional(),
|
transcript: z.string().optional(),
|
||||||
|
|
@ -98,8 +99,8 @@ const mediaSchema = ({ image }: SchemaContext) =>
|
||||||
message: 'Video media needs at least one mp4 or webm source.',
|
message: 'Video media needs at least one mp4 or webm source.',
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
.refine((item) => item.decorative || (Boolean(item.alt) && Boolean(item.caption)), {
|
.refine((item) => item.decorative || Boolean(item.caption), {
|
||||||
message: 'Meaningful media needs both alt text and a caption.',
|
message: 'Meaningful media needs a caption.',
|
||||||
});
|
});
|
||||||
|
|
||||||
// A single collection where each entry can carry an `article` facet (a written
|
// A single collection where each entry can carry an `article` facet (a written
|
||||||
|
|
@ -117,7 +118,6 @@ const articleFacet = ({ image }: SchemaContext) =>
|
||||||
tags: z.array(z.enum(TAGS)).default([]),
|
tags: z.array(z.enum(TAGS)).default([]),
|
||||||
stack: z.array(z.string()).optional(),
|
stack: z.array(z.string()).optional(),
|
||||||
scale: z.string().min(1).optional(),
|
scale: z.string().min(1).optional(),
|
||||||
outcome: z.string().min(1).optional(),
|
|
||||||
media: z.array(mediaSchema({ image })).default([]),
|
media: z.array(mediaSchema({ image })).default([]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,6 @@ const personJsonLd = buildPersonJsonLd();
|
||||||
projectPeriod={post.data.period}
|
projectPeriod={post.data.period}
|
||||||
stack={post.data.article?.stack}
|
stack={post.data.article?.stack}
|
||||||
scale={post.data.article?.scale}
|
scale={post.data.article?.scale}
|
||||||
outcome={post.data.article?.outcome}
|
|
||||||
links={post.data.links}
|
links={post.data.links}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue