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's",
|
||||
"importmap",
|
||||
"incrementality",
|
||||
"janky",
|
||||
"jemalloc",
|
||||
"keepalives",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ const textExtensions = new Set([
|
|||
'.mjs',
|
||||
'.ts',
|
||||
'.txt',
|
||||
'.vtt',
|
||||
'.webmanifest',
|
||||
'.xml',
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ const textExtensions = new Set([
|
|||
'.mjs',
|
||||
'.ts',
|
||||
'.txt',
|
||||
'.vtt',
|
||||
'.webmanifest',
|
||||
'.xml',
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ const MIME = {
|
|||
'.woff2': 'font/woff2',
|
||||
'.mp4': 'video/mp4',
|
||||
'.webm': 'video/webm',
|
||||
'.vtt': 'text/vtt; charset=utf-8',
|
||||
'.pdf': 'application/pdf',
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,18 +8,16 @@ interface Props {
|
|||
projectPeriod?: string;
|
||||
stack?: string[];
|
||||
scale?: string;
|
||||
outcome?: string;
|
||||
links?: Link[];
|
||||
headingId: string;
|
||||
}
|
||||
|
||||
const { projectPeriod, stack = [], scale, outcome, links = [], headingId } = Astro.props;
|
||||
const { projectPeriod, stack = [], scale, links = [], headingId } = Astro.props;
|
||||
|
||||
const rows: Array<[string, string]> = [];
|
||||
if (projectPeriod) rows.push(['Period', projectPeriod]);
|
||||
if (stack.length > 0) rows.push(['Stack', stack.join(', ')]);
|
||||
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}
|
||||
width={videoWidth}
|
||||
height={videoHeight}
|
||||
aria-label={item.alt}
|
||||
aria-label={item.caption}
|
||||
>
|
||||
{item.webm && <source src={item.webm} type="video/webm" />}
|
||||
{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 && (
|
||||
<Picture
|
||||
src={item.src}
|
||||
alt={item.decorative ? '' : (item.alt ?? '')}
|
||||
alt={item.decorative ? '' : (item.caption ?? '')}
|
||||
formats={['avif', 'webp']}
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ const playScript = `
|
|||
class="video-thumbnail__play"
|
||||
type="button"
|
||||
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">
|
||||
<svg viewBox="0 0 24 24" focusable="false">
|
||||
|
|
@ -106,7 +106,7 @@ const playScript = `
|
|||
preload="none"
|
||||
playsinline
|
||||
poster={video.poster?.src}
|
||||
aria-label={video.alt}
|
||||
aria-label={video.caption}
|
||||
hidden
|
||||
>
|
||||
{video.webm && <source src={video.webm} type="video/webm" />}
|
||||
|
|
|
|||
|
|
@ -72,13 +72,15 @@ const thumbnailOverrideSchema = ({ image }: SchemaContext) =>
|
|||
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) =>
|
||||
z
|
||||
.discriminatedUnion('type', [
|
||||
z.object({
|
||||
type: z.enum(['image', 'diagram']),
|
||||
src: image(),
|
||||
alt: z.string().optional(),
|
||||
decorative: z.boolean().optional(),
|
||||
caption: z.string().optional(),
|
||||
transcript: z.string().optional(),
|
||||
|
|
@ -89,7 +91,6 @@ const mediaSchema = ({ image }: SchemaContext) =>
|
|||
poster: image().optional(),
|
||||
mp4: mediaUrl.optional(),
|
||||
webm: mediaUrl.optional(),
|
||||
alt: z.string().optional(),
|
||||
decorative: z.boolean().optional(),
|
||||
caption: 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.',
|
||||
}),
|
||||
])
|
||||
.refine((item) => item.decorative || (Boolean(item.alt) && Boolean(item.caption)), {
|
||||
message: 'Meaningful media needs both alt text and a caption.',
|
||||
.refine((item) => item.decorative || Boolean(item.caption), {
|
||||
message: 'Meaningful media needs a caption.',
|
||||
});
|
||||
|
||||
// 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([]),
|
||||
stack: z.array(z.string()).optional(),
|
||||
scale: z.string().min(1).optional(),
|
||||
outcome: z.string().min(1).optional(),
|
||||
media: z.array(mediaSchema({ image })).default([]),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -140,7 +140,6 @@ const personJsonLd = buildPersonJsonLd();
|
|||
projectPeriod={post.data.period}
|
||||
stack={post.data.article?.stack}
|
||||
scale={post.data.article?.scale}
|
||||
outcome={post.data.article?.outcome}
|
||||
links={post.data.links}
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue