Pages

Use cases page

The site's use-cases hub: the header, the page head with the ASCII drift, the use cases as linked cards three across (each with three creatives on its Black cover), the closing section with the connect menu, and the footer.

Install

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

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

Use cases

Nine ways teams put Spyglass to work, from a single question to a tool of their own.

Give your agents the social internet

500 free credits every month. No card required.

Usage

An index of use cases, solutions or audiences, each card linking to its own page. content replaces the copy and the cards (lib/pages/use-cases.ts).

Never

  • Another brand's creative on a card: pass your own images as src or keep the Acme placeholders
  • Cards that move on hover
  • A second White button in the head: the hub has none

Each card takes title, line, meta (who it is for), href and a cover of three creatives. The header and footer read lib/pages/site-chrome.ts. sections lists the sections to show, in order (head, cards, close); a key left out is not shown. The covers' creatives are image slots. 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, resources-page, site-footer, site-header

Props

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

<UseCasesPage>

PropTypeDefault
contentUseCasesContent
menusHeaderMenus

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

sectionsreadonly UseCasesSection[]

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/use-cases-page/Page.tsx
import { UseCasesPage } from '@/react/components/pages/UseCasesPage'
// The use-cases hub as the site sets it, with Acme placeholder creatives on the cards.

export default function Page() {
  return <UseCasesPage />
}
elements/examples/use-cases-page/Page.html
<!-- The use-cases hub as the site sets it, with Acme placeholder creatives on the cards. -->
<spyglass-use-cases-page></spyglass-use-cases-page>

Source

react/components/pages/UseCasesPage.tsx
import { SiteHeader } from '@/react/components/site/SiteHeader'
import { AsciiTrail } from '@/react/components/visuals/AsciiTrail'
import { PageHead } from '@/react/components/site/PageHead'
import { ResourceCards } from '@/react/components/site/ResourceCards'
import { PageClose } from '@/react/components/site/PageClose'
import { SiteFooter } from '@/react/components/blocks/SiteFooter'
import { useCasesContent, type UseCasesContent, useCasesSections, type UseCasesSection } from '@/lib/pages/use-cases'
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 use-cases hub (app/use-cases, pages/UseCasesPage/UseCaseHub): the header, the page head (the title, the
// lead and the ASCII drift in the right columns), the use cases as linked cards (three across from 1024, two from 768,
// each with three creatives on its Black cover, Acme placeholders until you pass `src`), the section padding under
// them, the closing section with the connect menu, then the footer. `content` replaces the copy (lib/pages/use-cases.ts).
export interface UseCasesPageProps {
  content?: UseCasesContent
  /** 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 UseCasesSection[]
  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 UseCasesPage({ content: c = useCasesContent, menus, sections, className }: UseCasesPageProps) {
  const parts: Record<UseCasesSection, ReactNode> = {
    head: <PageHead id={c.id} lines={c.head.lines} lead={c.head.lead} />,
    cards: (
      <section aria-label={c.head.lines.join(' ')}>
        <div className={cn(CONTAINER, 'pb-(--ds-layout-section)')}>
          <ResourceCards cards={c.cards} columns={3} />
        </div>
      </section>
    ),
    close: <PageClose />,
  }
  return (
    <div data-ds="use-cases-page" className={cn('isolate bg-surface text-fg', className)}>
      <AsciiTrail mode="page" />
      <SiteHeader menus={menus} links={c.chrome.header.nav} secondary={c.chrome.header.secondary} cta={c.chrome.header.cta} />
      <main id="main">
        {pageSections(useCasesSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
      </main>
      <SiteFooter columns={c.chrome.footer.columns} legal={c.chrome.footer.legal} />
    </div>
  )
}

export default UseCasesPage
lib/pages/use-cases.ts
// The use-cases hub's copy (site app/use-cases, content/pages/use-cases.ts useCasesOverview): the head and the nine
// use cases in the menu's order, each a card with three Acme placeholder creatives as its cover. Both flavors read
// this file; the header and footer come from lib/pages/site-chrome.ts.
import type { ResourceCard } from '@/lib/resource-cards'
import { siteChrome, type SiteChrome } from '@/lib/pages/site-chrome'

const cover = (a: string, b: string, c: string, tone: 1 | 2 | 3 | 4 = 2): ResourceCard['cover'] => ({
	kind: 'creatives',
	items: [
		{ brand: a, tone },
		{ brand: b, tone: tone === 4 ? 3 : ((tone + 1) as 2 | 3 | 4) },
		{ brand: c, tone: tone === 1 ? 2 : ((tone - 1) as 1 | 2 | 3) },
	],
})

export interface UseCasesContent {
	id: string
	head: { lines: string[]; lead: string }
	cards: ResourceCard[]
	chrome: SiteChrome
}

export const useCasesContent: UseCasesContent = {
	id: 'use-cases',
	head: {
		lines: ['Use cases'],
		lead: 'Nine ways teams put Spyglass to work, from a single question to a tool of their own.',
	},
	cards: [
		{ title: 'Build your own', line: 'Your own agents, ad libraries and tools, built on the API and MCP server.', meta: 'For developers, AI builders and growth teams.', href: '/use-cases/build-your-own', cover: cover('Acme', 'Acme', 'Acme', 2) },
		{ title: 'Creative research', line: 'The hooks, angles and formats that win for any brand, worked out before you ask.', meta: 'For creative strategists, designers and performance teams.', href: '/use-cases/creative-research', cover: cover('Acme', 'Acme', 'Acme', 3) },
		{ title: 'Paid media', line: 'What brands are running, how long, with which hooks, angles and landing pages.', meta: 'For performance marketers, creative strategists and agencies.', href: '/use-cases/paid-media', cover: cover('Acme', 'Acme', 'Acme', 1) },
		{ title: 'Organic social', line: 'What brands and creators post and how it performs.', meta: 'For social and brand teams.', href: '/use-cases/organic-social', cover: cover('Acme', 'Acme', 'Acme', 3) },
		{ title: 'Competitive analysis', line: 'What competitors launch, test and keep running, from the day it goes live.', meta: 'For brand, growth and strategy teams, and agencies.', href: '/use-cases/competitive-analysis', cover: cover('Acme', 'Acme', 'Acme', 2) },
		{ title: 'Creators', line: 'Finding and hiring creators at scale, and seeing who works with whom.', meta: 'For creator and partnerships teams, and agencies.', href: '/use-cases/creators', cover: cover('Acme', 'Acme', 'Acme', 4) },
		{ title: 'Consumer sentiment', line: 'What people say about brands and products in the comments, sorted into what to act on.', meta: 'For brand, social, product and insights teams.', href: '/use-cases/consumer-sentiment', cover: cover('Acme', 'Acme', 'Acme', 3) },
		{ title: 'Landing page development', line: 'Where a brand’s ads lead, and the pages it keeps sending them to.', meta: 'For growth, CRO and web teams.', href: '/use-cases/landing-page-development', cover: cover('Acme', 'Acme', 'Acme', 4) },
		{ title: '360-degree research', line: 'One brand, all of it: its ads, posts, creators, landing pages and comments on one record.', meta: 'For strategists, agencies and brand teams.', href: '/use-cases/360-degree-research', cover: cover('Acme', 'Acme', 'Acme', 2) },
	],
	chrome: siteChrome,
}

/** The use cases index's sections in order; pass `sections` to reorder them or leave some out. */
export const useCasesSections = ['head', 'cards', 'close'] as const
export type UseCasesSection = (typeof useCasesSections)[number]
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/use-cases-page.ts
import { html } from 'lit'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { useCasesContent, type UseCasesContent, useCasesSections, type UseCasesSection } from '@/lib/pages/use-cases'
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'

// UseCasesPage.tsx as <spyglass-use-cases-page>: the header, the page head, the use cases as linked cards (three across
// from 1024), the closing section with the connect menu, then the footer. `content` replaces the copy.
const CONTAINER = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'

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

	render() {
		const c = this.content ?? useCasesContent
		const parts: Record<UseCasesSection, unknown> = {
			head: html`<spyglass-page-head head-id=${c.id} .lines=${c.head.lines} .lead=${c.head.lead}></spyglass-page-head>`,
			cards: html`<section aria-label=${c.head.lines.join(' ')}><div class=${`${CONTAINER} pb-(--ds-layout-section)`}><spyglass-resource-cards .cards=${c.cards} columns="3"></spyglass-resource-cards></div></section>`,
			close: html`<spyglass-page-close></spyglass-page-close>`,
		}
		return html`<div data-ds="use-cases-page" class="isolate bg-surface text-fg"><spyglass-ascii-trail mode="page"></spyglass-ascii-trail><spyglass-site-header .menus=${this.menus ?? headerMenus} .links=${c.chrome.header.nav} .secondary=${c.chrome.header.secondary} .cta=${c.chrome.header.cta}></spyglass-site-header><main id="main">${pageSections(useCasesSections, this.sections).map((k) => parts[k])}</main><spyglass-site-footer .columns=${c.chrome.footer.columns} legal=${c.chrome.footer.legal}></spyglass-site-footer></div>`
	}
}

define('use-cases-page', UseCasesPage)

Reference: Site app/use-cases/page.tsx and pages/UseCasesPage (UseCaseHub.tsx, UseCaseHub.module.css over Resources.module.css): PageHead with the title and lead, the cards in .container three across from 1024 with the 240px cover, the section padding under them, PageClose, the footer.