Pages
Resource list page
The site's list of posts or guides: the header, the page head with the list's title and line, the entries newest first as hairline rows (date, title, line; with a thumb, a 16:9 picture on the left and the three lines stacked beside it), or a quiet panel with the empty note and the way back to all resources, then the closing section and the footer.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add resource-list-page<script type="module" src="/spyglass-ds/elements/resource-list-page.js"></script>Blog
What the Acme team shipped, and what is next.
No posts yet. The first ones are on the way.
All resourcesGive your agents the social internet
500 free credits every month. No card required.
Articles
Guides to creative research with agents.
- Reading a category from its longest-running adsWhy the ads a brand keeps paying for say more than the ones it launches.
- Briefing an agent on a competitorThe three questions that turn an ad library into a brief.
- Hooks, angles and formatsA shared vocabulary for creative research, with examples from one category.
Give your agents the social internet
500 free credits every month. No card required.
Usage
A blog, articles or guides index; list takes the entries (an empty list shows the empty panel), content the rest of the copy.
Never
- Cards in the rows: the list is hairline rows, with at most a small 16:9 thumbnail on the left
- Dates in a local time zone: they read in UTC so every reader sees the same day
- Real authors or customers in the copy: Acme only
sections lists the sections to show, in order (head, list, close); a key left out is not shown. Each entry's thumb is an image slot or a placeholder tone. menus passes the header menus (the live card's picture, the use cases' shots).
Adds with it: ascii-trail, button, creative-card, page-close, page-head, resources-page, site-footer, site-header
Props
The web component takes the same as attributes or properties (<spyglass-resource-list-page>); title is heading there.
<ResourceListPage>
| Prop | Type | Default |
|---|---|---|
list | ResourceList | |
content | ResourceListContent | |
menus | HeaderMenus The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. | |
sections | readonly ResourceListSection[] The sections to show, in order; all of them in the page order by default (leave one out to omit it). | |
className | string |
Examples
The same example in React and as web components; both render identically.
import { ResourceListPage } from '@/react/components/pages/ResourceListPage'
// The blog before its first post, as the site shows it today.
export default function Empty() {
return <ResourceListPage />
}<!-- The blog before its first post, as the site shows it today. -->
<spyglass-resource-list-page></spyglass-resource-list-page>import { ResourceListPage } from '@/react/components/pages/ResourceListPage'
import { articlesList } from '@/lib/pages/resources'
// A list with entries: Acme's articles, newest first.
export default function Articles() {
return <ResourceListPage list={articlesList} />
}<!-- A list with entries: Acme's articles, newest first. -->
<spyglass-resource-list-page list='{"key":"articles","title":"Articles","line":"Guides to creative research with agents.","empty":"No articles yet. The first ones are on the way.","entries":[{"title":"Reading a category from its longest-running ads","line":"Why the ads a brand keeps paying for say more than the ones it launches.","href":"/resources/articles/longest-running-ads","date":"2026-11-12","thumb":{"tone":2}},{"title":"Briefing an agent on a competitor","line":"The three questions that turn an ad library into a brief.","href":"/resources/articles/briefing-an-agent","date":"2026-10-28","thumb":{"tone":3}},{"title":"Hooks, angles and formats","line":"A shared vocabulary for creative research, with examples from one category.","href":"/resources/articles/hooks-angles-formats","date":"2026-10-09","thumb":{"tone":1}}]}'></spyglass-resource-list-page>Source
import { Button } from '@/react/components/ui/Button'
import { AsciiTrail } from '@/react/components/visuals/AsciiTrail'
import { PageClose } from '@/react/components/site/PageClose'
import { PageHead } from '@/react/components/site/PageHead'
import { SiteHeader } from '@/react/components/site/SiteHeader'
import { SiteFooter } from '@/react/components/blocks/SiteFooter'
import { CreativeCard } from '@/react/components/site/CreativeCard'
import { formatResourceDate, resourceListContent, type ResourceList, type ResourceListContent, resourceListSections, type ResourceListSection } from '@/lib/pages/resources'
import { cn } from '@/react/lib/cn'
import { pageSections } from '@/lib/image'
import { Fragment, type ReactNode } from 'react'
import type { HeaderMenus } from '@/lib/site-header'
// The site's list of posts or guides (app/resources/[slug], pages/Resources/ResourceList): the header, the page head
// with the list's title and line, then the entries newest first as hairline rows (the date in the muted gray, the
// title at 20/28 and its line in the soft gray; the date in a 160px column from 768; an entry with a `thumb` puts
// its 16:9 picture in a 96px column, 160 from 768, with the three lines stacked beside it), or, with no entries yet, a
// #1A1A1A panel with the empty note and a quiet way back. The closing section and the footer follow. `list` sets
// the list (lib/pages/resources.ts has the blog, empty, and articles); `content` the rest of the copy.
export interface ResourceListPageProps {
list?: ResourceList
content?: ResourceListContent
/** The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. */
menus?: HeaderMenus
/** The sections to show, in order; all of them in the page order by default (leave one out to omit it). */
sections?: readonly ResourceListSection[]
className?: string
}
/** A row's grid: date, title and line stacked; with a thumbnail, the picture in a 96px column (160 from 768) beside them. */
const resourceRowClass = (thumb: boolean) =>
thumb
? 'group grid grid-cols-[--spacing(24)_minmax(0,1fr)] items-start gap-x-5 gap-y-1 border-b border-edge py-6 focus-visible:-outline-offset-2 md:grid-cols-[160px_minmax(0,1fr)] md:gap-x-8'
: 'group grid gap-1 border-b border-edge py-6 focus-visible:-outline-offset-2 md:grid-cols-[160px_minmax(0,1fr)] md:gap-x-8'
/** The thumbnail's cell: the first column, across the three lines. */
const RESOURCE_THUMB = 'col-start-1 row-span-3 row-start-1'
const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
export function ResourceListPage({ list, content: c = resourceListContent, menus, sections, className }: ResourceListPageProps) {
const l = list ?? c.list
const entries = [...l.entries].sort((a, b) => b.date.localeCompare(a.date))
const parts: Record<ResourceListSection, ReactNode> = {
head: <PageHead id={l.key} lines={[l.title]} lead={l.line} />,
list: (
<section aria-label={l.title} className="pb-(--ds-layout-section)">
<div className={CONTAINER}>
{entries.length ? (
<ul role="list" className="m-0 list-none border-t border-edge p-0">
{entries.map((e) => (
<li key={e.href}>
<a href={e.href} className={resourceRowClass(!!e.thumb)}>
{e.thumb ? <CreativeCard ratio="16/9" src={e.thumb.src} alt={e.thumb.alt} fit={e.thumb.fit} position={e.thumb.position} tone={e.thumb.tone} className={RESOURCE_THUMB} /> : null}
<time dateTime={e.date} className={cn('type-ui text-fg-muted', e.thumb && 'col-start-2')}>{formatResourceDate(e.date)}</time>
<span className={cn('type-body-lg text-fg', e.thumb && 'col-start-2')}>{e.title}</span>
<span className={cn('type-body text-pretty text-fg-soft md:col-start-2', e.thumb && 'col-start-2')}>{e.line}</span>
</a>
</li>
))}
</ul>
) : (
<div className="flex min-h-80 flex-col items-center justify-center gap-6 rounded-panel bg-surface-subtle p-8 text-center text-fg-soft">
<p className="type-body-lg">{l.empty}</p>
<Button href={c.back.href} variant="secondary" className="max-md:w-full">{c.back.label}</Button>
</div>
)}
</div>
</section>
),
close: <PageClose lines={c.close.lines} note={c.close.note} primary={c.close.primary} />,
}
return (
<div data-ds="resource-list-page" className={cn('isolate overflow-x-clip bg-surface text-fg', className)}>
<AsciiTrail mode="page" />
<SiteHeader menus={menus} links={c.header.nav} secondary={c.header.secondary} cta={c.header.cta} />
<main>
{pageSections(resourceListSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
</main>
<SiteFooter columns={c.footer.columns} legal={c.footer.legal} />
</div>
)
}
export default ResourceListPage// Joins class names, skipping falsy ones: cn('a', on && 'b', ['c', undefined]). It does not merge conflicting
// utilities (no tailwind-merge), as Vue's class binding does not: the library's classes are written not to compete,
// and a className from the caller is appended after them, as Vue appends a fallthrough class.
export type ClassValue = string | false | null | undefined | 0 | ClassValue[]
export function cn(...values: ClassValue[]): string {
const out: string[] = []
for (const v of values) {
if (!v) continue
if (Array.isArray(v)) {
const s = cn(...v)
if (s) out.push(s)
}
else out.push(v)
}
return out.join(' ')
}import { html, nothing } from 'lit'
import { ifDefined } from 'lit/directives/if-defined.js'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { formatResourceDate, resourceListContent, type ResourceList, type ResourceListContent, resourceListSections, type ResourceListSection } from '@/lib/pages/resources'
import '@/elements/components/ui/button'
import '@/elements/components/site/creative-card'
import '@/elements/components/site/site-header'
import '@/elements/components/site/page-head'
import '@/elements/components/site/page-close'
import '@/elements/components/blocks/site-footer'
import '@/elements/components/visuals/ascii-trail'
import styles from 'virtual:tw'
import { pageSections } from '@/lib/image'
import { headerMenus, type HeaderMenus } from '@/lib/site-header'
// ResourceListPage.tsx as <spyglass-resource-list-page>: the header, the page head, the entries newest first as
// hairline rows (or the empty panel with a quiet way back), the closing section and the footer. `list` (JSON) sets the
// list; `content` (JSON) the rest of the copy (lib/pages/resources.ts).
/** A row's grid: date, title and line stacked; with a thumbnail, the picture in a 96px column (160 from 768) beside them. */
const resourceRowClass = (thumb: boolean) =>
thumb
? 'group grid grid-cols-[--spacing(24)_minmax(0,1fr)] items-start gap-x-5 gap-y-1 border-b border-edge py-6 focus-visible:-outline-offset-2 md:grid-cols-[160px_minmax(0,1fr)] md:gap-x-8'
: 'group grid gap-1 border-b border-edge py-6 focus-visible:-outline-offset-2 md:grid-cols-[160px_minmax(0,1fr)] md:gap-x-8'
/** The thumbnail's cell: the first column, across the three lines. */
const RESOURCE_THUMB = 'col-start-1 row-span-3 row-start-1'
const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'
/**
* @summary A list of posts or guides, or its empty state.
*/
export class ResourceListPage extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="resource-list-page"]'))
static properties = { list: { type: Object }, content: { type: Object }, menus: { type: Object }, sections: { type: Array } }
/** The list: { key, title, line, entries: { title, line, href, date, thumb? }[], empty }. */
list?: ResourceList
/** The copy (lib/pages/resources.ts by default). */
content: ResourceListContent = resourceListContent
/** The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default. */
menus?: HeaderMenus
/** The sections to show, in order (a list of names); all of them in the page order by default. */
sections?: ResourceListSection[]
render() {
const c = this.content ?? resourceListContent
const l = this.list ?? c.list
const entries = [...l.entries].sort((a, b) => b.date.localeCompare(a.date))
const body = entries.length
? html`<ul role="list" class="m-0 list-none border-t border-edge p-0">${entries.map((e) => html`<li><a href=${e.href} class=${resourceRowClass(!!e.thumb)}>${e.thumb ? html`<spyglass-creative-card ratio="16/9" src=${ifDefined(e.thumb.src)} alt=${ifDefined(e.thumb.alt)} fit=${ifDefined(e.thumb.fit)} position=${ifDefined(e.thumb.position)} tone=${ifDefined(e.thumb.tone)} class=${RESOURCE_THUMB}></spyglass-creative-card>` : nothing}<time datetime=${e.date} class=${['type-ui text-fg-muted', e.thumb ? 'col-start-2' : ''].join(' ')}>${formatResourceDate(e.date)}</time><span class=${['type-body-lg text-fg', e.thumb ? 'col-start-2' : ''].join(' ')}>${e.title}</span><span class=${['type-body text-pretty text-fg-soft md:col-start-2', e.thumb ? 'col-start-2' : ''].join(' ')}>${e.line}</span></a></li>`)}</ul>`
: html`<div class="flex min-h-80 flex-col items-center justify-center gap-6 rounded-panel bg-surface-subtle p-8 text-center text-fg-soft"><p class="type-body-lg">${l.empty}</p><spyglass-button href=${c.back.href} variant="secondary" class="max-md:w-full">${c.back.label}</spyglass-button></div>`
const parts: Record<ResourceListSection, unknown> = {
head: html`<spyglass-page-head head-id=${l.key} .lines=${[l.title]} lead=${l.line}></spyglass-page-head>`,
list: html`<section aria-label=${l.title} class="pb-(--ds-layout-section)"><div class=${CONTAINER}>${body}</div></section>`,
close: html`<spyglass-page-close .lines=${c.close.lines} note=${c.close.note} .primary=${c.close.primary}></spyglass-page-close>`,
}
return html`<div data-ds="resource-list-page" class="isolate overflow-x-clip bg-surface text-fg"><spyglass-ascii-trail mode="page"></spyglass-ascii-trail><spyglass-site-header .menus=${this.menus ?? headerMenus} .links=${c.header.nav} .secondary=${c.header.secondary} .cta=${c.header.cta}></spyglass-site-header><main>${pageSections(resourceListSections, this.sections).map((k) => parts[k])}</main><spyglass-site-footer .columns=${c.footer.columns} legal=${c.footer.legal}></spyglass-site-footer></div>`
}
}
define('resource-list-page', ResourceListPage)Reference: Site app/resources/[slug]/page.tsx and pages/Resources (ResourceList.tsx, Resources.module.css .list, .row, .date, .rowTitle, .empty): rows 24px tall padding with a hairline under each, the date 14/20 in --text-3 in a 160px column 32px from the title from 768, the title 20/28, the line in --text-2; .rowThumb and .thumb: a 96px picture column 20px from the text (160 and 32 from 768), the picture 16:9 with --radius-s across the three lines; the back button full width below 768 (globals.css main a.btn); the empty panel --raised with --radius-m, at least 320px tall, 32px in, the note 20/28 and the quiet button 24px under it.