Pages

Resources page

The site's resources page: the header, the page head with its ASCII drift, the hub's linked cards (templates, docs with code, case studies) in two columns, the hairline rows of what is coming, the closing section and the footer.

Install

React apps get the React files; every other stack gets the web component.

npx spyglass-ds add resources-page
<script type="module" src="/spyglass-ds/elements/resources-page.js"></script>

Usage

A resources or learn index that links to templates, docs, case studies and writing; content replaces the copy.

Never

  • Another brand's creatives in the covers: pass your own images as src or keep the Acme placeholders
  • Real customers or people in the copy: Acme only
  • A second White button in the hub: the cards are links on the surface

sections lists the sections to show, in order (head, cards, close); a key left out is not shown. The covers' creatives are image slots (or the placeholder's brand and tone). menus passes the header menus (the live card's picture, the use cases' shots).

Adds with it: ascii-trail, creative-card, page-close, page-head, resource-cards, site-footer, site-header

Props

The web component takes the same as attributes or properties (<spyglass-resources-page>); title is heading there.

<ResourcesPage>

PropTypeDefault
contentResourcesContent
menusHeaderMenus

The header menus' content, pictures included (the live card's `picture`, the use cases' `shots`); Acme by default.

sectionsreadonly ResourcesSection[]

The sections to show, in order; all of them in the page order by default (leave one out to omit it).

classNamestring

Examples

The same example in React and as web components; both render identically.

react/examples/resources-page/Page.tsx
import { ResourcesPage } from '@/react/components/pages/ResourcesPage'
// The resources page as the site sets it, with Acme's copy and placeholder creatives.

export default function Page() {
  return <ResourcesPage />
}
elements/examples/resources-page/Page.html
<!-- The resources page as the site sets it, with Acme's copy and placeholder creatives. -->
<spyglass-resources-page></spyglass-resources-page>

Source

react/components/pages/ResourcesPage.tsx
import { PageClose } from '@/react/components/site/PageClose'
import { AsciiTrail } from '@/react/components/visuals/AsciiTrail'
import { PageHead } from '@/react/components/site/PageHead'
import { ResourceCards } from '@/react/components/site/ResourceCards'
import { SiteHeader } from '@/react/components/site/SiteHeader'
import { SiteFooter } from '@/react/components/blocks/SiteFooter'
import { resourcesContent, type ResourcesContent, resourcesSections, type ResourcesSection } 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 resources page (app/resources, pages/Resources/ResourceHub): the header, the page head with its drift,
// the hub's cards (templates, docs, case studies) and the rows of what is coming, the closing section and the footer.
// `content` replaces the copy (lib/pages/resources.ts); the covers' creatives are Acme placeholders until you pass
// your images as `src`.
export interface ResourcesPageProps {
  content?: ResourcesContent
  /** 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 ResourcesSection[]
  className?: string
}

const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'

export function ResourcesPage({ content: c = resourcesContent, menus, sections, className }: ResourcesPageProps) {
  const parts: Record<ResourcesSection, ReactNode> = {
    head: <PageHead id={c.head.id} lines={c.head.lines} lead={c.head.lead} />,
    cards: (
      <section aria-label={c.head.lines.join(' ')}>
        <div className={CONTAINER}>
          <ResourceCards cards={c.cards} rows={c.rows} rowsLabel={c.rowsLabel} className="mb-(--ds-layout-section)" />
        </div>
      </section>
    ),
    close: <PageClose lines={c.close.lines} note={c.close.note} primary={c.close.primary} />,
  }
  return (
    <div data-ds="resources-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(resourcesSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
      </main>
      <SiteFooter columns={c.footer.columns} legal={c.footer.legal} />
    </div>
  )
}

export default ResourcesPage
lib/pages/resources.ts
// The resources pages' copy (the site's content/pages/resources.ts): the hub's cards and its rows of what is not ready,
// and the blog and articles lists with their empty state. The covers' creatives are Acme placeholders; pass your own
// images as `src`. Both flavors read this file.
import { siteChrome } from '@/lib/pages/site-chrome'
import type { ResourceCard, ResourceRow } from '@/lib/resource-cards'
import type { ImageSlot } from '@/lib/image'

/** An Acme placeholder creative for a cover. */
const tile = (brand: string, tone: 1 | 2 | 3 | 4) => ({ brand, tone })

export interface ResourceEntry {
	title: string
	line: string
	href: string
	/** ISO date, 2026-11-01. */
	date: string
	/** A 16:9 picture on the left of the row (the post's cover): your image as `src` (with `alt`, `fit`, `position`), or a neutral tone (1 to 4). */
	thumb?: ImageSlot & { tone?: 1 | 2 | 3 | 4 }
}

export interface ResourceList {
	key: string
	title: string
	line: string
	entries: ResourceEntry[]
	/** What the page says while there are no entries. */
	empty: string
}

export const resourcesContent = {
	...siteChrome,
	head: { id: 'resources', lines: ['Resources'], lead: 'Templates, writing and docs for building on Acme.' },
	cards: [
		{
			title: 'Templates',
			line: 'Ready-made playbooks that run inside Claude or ChatGPT on Acme data.',
			href: '/templates',
			meta: '4 templates, coming soon',
			cover: { kind: 'creatives', items: [tile('Acme Skin', 2), tile('Acme Drinks', 3), tile('Acme Studio', 1), tile('Acme Fit', 4)] },
		},
		{
			title: 'Docs',
			line: 'Set up the MCP server, call the REST API and use the SDKs.',
			href: 'https://docs.acme.com',
			meta: 'docs.acme.com',
			cover: { kind: 'code', source: ['# The CLI', 'npm install -g @acme/cli', '# The MCP server', 'https://mcp.acme.com/mcp', '# The REST API', 'https://api.acme.com/v2'].join('\n') },
		},
		{
			title: 'Case studies',
			line: 'How agencies and marketing teams put Acme to work.',
			href: '/resources/case-studies',
			meta: '2 case studies',
			cover: { kind: 'creatives', items: [tile('Acme Skin', 3), tile('Acme Beauty', 2), tile('Acme Skin', 4)] },
		},
	] as ResourceCard[],
	rowsLabel: 'More resources',
	rows: [
		{ title: 'Blog', line: 'What the Acme team shipped, and what is next.', badge: 'Coming soon' },
		{ title: 'Articles', line: 'Guides to creative research with agents.', badge: 'Coming soon' },
		{ title: 'Demos', line: 'Acme at work in Claude, ChatGPT and Cursor.', badge: 'Coming soon' },
	] as ResourceRow[],
}

export type ResourcesContent = typeof resourcesContent

/** The blog with no posts yet, as the site shows it today. */
export const blogList: ResourceList = { key: 'blog', title: 'Blog', line: 'What the Acme team shipped, and what is next.', entries: [], empty: 'No posts yet. The first ones are on the way.' }

/** The articles list with entries, newest first once sorted. */
export const articlesList: ResourceList = {
	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 } },
	],
}

export const resourceListContent = {
	...siteChrome,
	back: { label: 'All resources', href: '/resources' },
	list: blogList,
}

export type ResourceListContent = typeof resourceListContent

/** "Nov 12, 2026" from an ISO date, in UTC so every reader sees the same day. */
export function formatResourceDate(iso: string): string {
	return new Date(`${iso}T00:00:00Z`).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric', timeZone: 'UTC' })
}

/** The resources hub's sections in order; pass `sections` to reorder them or leave some out. */
export const resourcesSections = ['head', 'cards', 'close'] as const
export type ResourcesSection = (typeof resourcesSections)[number]

/** The resource list page's sections in order; pass `sections` to reorder them or leave some out. */
export const resourceListSections = ['head', 'list', 'close'] as const
export type ResourceListSection = (typeof resourceListSections)[number]
lib/pages/site-chrome.ts
// The site's chrome copy for the inner pages (resources, case studies, use cases): the header's links and actions, the
// closing section and the footer's six columns, as the site lists them, with Acme's legal line. Both flavors read this file.
export const siteChrome = {
	header: {
		nav: [
			{ label: 'Products', href: '/products' },
			{ label: 'Use cases', href: '/use-cases' },
			{ label: 'Enterprise', href: '/enterprise' },
			{ label: 'Resources', href: '/resources' },
			{ label: 'Pricing', href: '/pricing' },
		],
		secondary: { label: 'Sign in', href: '/sign-in' },
		cta: { label: 'Get a free API key', href: '/sign-up', short: 'Get API key' },
	},
	footer: {
		columns: [
			{ title: 'Products', wide: true, links: [{ label: 'Brands and creators', href: '/products/brand-search' }, { label: 'Media archive', href: '/products/media-search' }, { label: 'Collaborations', href: '/products/creator-collabs' }, { label: 'Creative insights', href: '/products/creative-insights' }, { label: 'Realtime search', href: '/products/realtime-search' }, { label: 'Coming soon', href: '/coming-soon' }] },
			{ title: 'Use cases', wide: true, links: [{ label: 'Build your own', href: '/use-cases/build' }, { label: 'Creative research', href: '/use-cases/creative-research' }, { label: 'Paid ads', href: '/use-cases/paid-ads' }, { label: 'Organic social', href: '/use-cases/organic-social' }, { label: 'Competitive analysis', href: '/use-cases/competitive-analysis' }, { label: 'Creator sourcing', href: '/use-cases/creator-sourcing' }] },
			{ title: 'Resources', links: [{ label: 'Templates', href: '/templates' }, { label: 'Docs', href: '/docs' }, { label: 'Blog', href: '/resources/blog' }, { label: 'Articles', href: '/resources/articles' }] },
			{ title: 'Company', links: [{ label: 'Enterprise', href: '/enterprise' }, { label: 'Talk to us', href: '/enterprise#contact' }, { label: 'Sign in', href: '/sign-in' }] },
			{ title: 'Legal', links: [{ label: 'Terms', href: '/terms' }, { label: 'Privacy', href: '/privacy' }] },
			{ title: 'Community', links: [{ label: 'X', href: 'https://x.com' }, { label: 'LinkedIn', href: 'https://linkedin.com' }, { label: 'Instagram', href: 'https://instagram.com' }] },
		],
		legal: '© 2026 Acme Inc.',
	},
	close: {
		lines: ['Give your agents', 'the social internet'],
		note: '500 free credits every month. No card required.',
		primary: { label: 'Get a free API key', href: '/sign-up' },
	},
}

export type SiteChrome = typeof siteChrome
react/lib/cn.ts
// 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(' ')
}
elements/components/pages/resources-page.ts
import { html } from 'lit'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { resourcesContent, type ResourcesContent, resourcesSections, type ResourcesSection } from '@/lib/pages/resources'
import '@/elements/components/site/site-header'
import '@/elements/components/site/page-head'
import '@/elements/components/site/resource-cards'
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'

// ResourcesPage.tsx as <spyglass-resources-page>: the header, the page head, the hub's cards and rows, the closing
// section and the footer. `content` (JSON) replaces the copy (lib/pages/resources.ts).

const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'

/**
 * @summary The resources page.
 */
export class ResourcesPage extends DsElement {
	static styles = [DsElement.styles, styles]
	protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="resources-page"]'))
	static properties = { content: { type: Object }, menus: { type: Object }, sections: { type: Array } }
	/** The copy (lib/pages/resources.ts by default). */
	content: ResourcesContent = resourcesContent
	/** 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?: ResourcesSection[]

	render() {
		const c = this.content ?? resourcesContent
		const parts: Record<ResourcesSection, unknown> = {
			head: html`<spyglass-page-head head-id=${c.head.id} .lines=${c.head.lines} lead=${c.head.lead}></spyglass-page-head>`,
			cards: html`<section aria-label=${c.head.lines.join(' ')}><div class=${CONTAINER}><spyglass-resource-cards class="mb-(--ds-layout-section)" .cards=${c.cards} .rows=${c.rows} rows-label=${c.rowsLabel}></spyglass-resource-cards></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="resources-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(resourcesSections, this.sections).map((k) => parts[k])}</main><spyglass-site-footer .columns=${c.footer.columns} legal=${c.footer.legal}></spyglass-site-footer></div>`
	}
}

define('resources-page', ResourcesPage)

Reference: Site app/resources/page.tsx and pages/Resources (ResourceHub.tsx, Resources.module.css): PageHead, the hub in the container with the section padding under it, PageClose and the footer.