Pages

Careers page

The careers page: the page head with the light, why join as three cards and the open roles as rows under hairlines.

Install

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

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

Careers

Build the record of creative.

A small team, working in the open, shipping every week.

Small team

Every person owns a part of the product.

Remote first

Work from anywhere in two time zones of each other.

Ship weekly

Something reaches customers every week.

Open roles

Usage

A careers page; roles come through content.

Never

  • New colors, shadows or type sizes added to a section: use the items' props
  • More than one White button in a view
  • Real people or customers in the copy: Acme only

sections lists the sections to show, in order (hero, values, roles); a key left out is not shown. menus passes the header menus (the live card's picture, the use cases' shots).

Adds with it: creative-card, footer-row, hero-block, not-found-page, site-header packages lucide-react

Props

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

<CareersPage>

PropTypeDefault
contentCareersContent
menusHeaderMenus

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

sectionsreadonly CareersSection[]

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/careers-page/Page.tsx
import { CareersPage } from '@/react/components/pages/CareersPage'
// The careers page with its own copy (Acme).

export default function Page() {
  return <CareersPage />
}
elements/examples/careers-page/Page.html
<!-- The careers page with its own copy (Acme). -->
<spyglass-careers-page></spyglass-careers-page>

Source

react/components/pages/CareersPage.tsx
import { ArrowUpRight } from 'lucide-react'
import { FooterRow } from '@/react/components/site/FooterRow'
import { SiteHeader } from '@/react/components/site/SiteHeader'
import { HeroBlock } from '@/react/components/blocks/HeroBlock'
import { careersContent, type CareersContent, careersSections, type CareersSection } from '@/lib/pages/careers'
import { notFoundContent } from '@/lib/pages/not-found'
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 careers page from library items: the header, the page head with the light, why join as three #262626 cards, and
// the open roles as rows under #363636 hairlines (the title in Funnel Display 24/28, the team and place in #A3A3A3, a
// small arrow that brightens with the row and never moves). No roles shows `none`. The footer row at the foot.
export interface CareersPageProps {
  content?: CareersContent
  /** 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 CareersSection[]
  className?: string
}

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

export function CareersPage({ content: c = careersContent, menus, sections, className }: CareersPageProps) {
  const h = notFoundContent
  const parts: Record<CareersSection, ReactNode> = {
    hero: <HeroBlock eyebrow={c.eyebrow} headline={c.headline} body={c.body} light="field" />,
    values: (
      <section className={cn(WRAP, 'grid gap-4 pb-16 md:grid-cols-3')}>
        {c.values.map((v) => (
          <div key={v.title} className="grid content-start gap-2 rounded-container bg-surface-raised p-6">
            <h2 className="type-heading-3">{v.title}</h2>
            <p className="type-body text-fg-soft">{v.body}</p>
          </div>
        ))}
      </section>
    ),
    roles: (
      <section className={cn(WRAP, 'grid gap-8 pb-24')}>
        <h2 className="type-section">{c.rolesTitle}</h2>
        {c.roles.length ? (
          <ul role="list" className="m-0 list-none border-b border-edge p-0">
            {c.roles.map((r) => (
              <li key={r.title} className="border-t border-edge">
                <a href={r.href} className="group flex items-center gap-6 rounded-ds-sm py-6 transition-[color] duration-160 ease-out">
                  <span className="grid flex-1 gap-1 sm:flex sm:items-baseline sm:justify-between sm:gap-6">
                    <span className="type-heading-3 text-fg">{r.title}</span>
                    <span className="type-ui text-fg-muted">{r.team} · {r.location}</span>
                  </span>
                  <ArrowUpRight size={20} strokeWidth={1.5} aria-hidden="true" className="shrink-0 text-fg-muted transition-[color] duration-160 ease-out group-hover:text-fg" />
                </a>
              </li>
            ))}
          </ul>
        ) : <p className="type-body text-fg-soft">{c.none}</p>}
      </section>
    ),
  }
  return (
    <div data-ds="careers-page" className={cn('flex min-h-dvh flex-col bg-surface text-fg', className)}>
      <SiteHeader menus={menus} links={h.header.nav} secondary={h.header.secondary} cta={h.header.cta} />
      <main className="flex-1">
        {pageSections(careersSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
      </main>
      <footer className="border-t border-edge"><div className={cn(WRAP, 'py-10')}><FooterRow domain={h.footer.domain} homeHref="/" links={h.footer.links} /></div></footer>
    </div>
  )
}

export default CareersPage
lib/pages/careers.ts
// The careers page's copy: a head, why join in three lines, and the open roles. Both flavors read this file.
export const careersContent = {
	eyebrow: 'Careers',
	headline: 'Build the record of creative.',
	body: 'A small team, working in the open, shipping every week.',
	values: [
		{ title: 'Small team', body: 'Every person owns a part of the product.' },
		{ title: 'Remote first', body: 'Work from anywhere in two time zones of each other.' },
		{ title: 'Ship weekly', body: 'Something reaches customers every week.' },
	],
	rolesTitle: 'Open roles',
	roles: [
		{ title: 'Founding designer', team: 'Design', location: 'Remote', href: '#designer' },
		{ title: 'Senior engineer, search', team: 'Engineering', location: 'Remote', href: '#search' },
		{ title: 'Growth lead', team: 'Marketing', location: 'New York', href: '#growth' },
	],
	none: 'No open roles right now.',
}
export type CareersContent = typeof careersContent

/** The careers page's sections in order; pass `sections` to reorder them or leave some out. */
export const careersSections = ['hero', 'values', 'roles'] as const
export type CareersSection = (typeof careersSections)[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/careers-page.ts
import { html } from 'lit'
import { ArrowUpRight } from 'lucide'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { icon } from '@/elements/lib/icon'
import { careersContent, type CareersContent, careersSections, type CareersSection } from '@/lib/pages/careers'
import { notFoundContent } from '@/lib/pages/not-found'
import '@/elements/components/blocks/hero-block'
import '@/elements/components/site/footer-row'
import '@/elements/components/site/site-header'
import styles from 'virtual:tw'
import { pageSections } from '@/lib/image'
import { headerMenus, type HeaderMenus } from '@/lib/site-header'

// CareersPage.tsx as <spyglass-careers-page>: the head, why join as three cards, the open roles as rows. `content`
// replaces the copy.
const WRAP = 'mx-auto w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] px-(--ds-layout-gutter)'

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

	render() {
		const c = this.content ?? careersContent
		const h = notFoundContent
		const parts: Record<CareersSection, unknown> = {
			hero: html`<spyglass-hero-block eyebrow=${c.eyebrow} headline=${c.headline} body=${c.body} light="field"></spyglass-hero-block>`,
			values: html`<section class=${`${WRAP} grid gap-4 pb-16 md:grid-cols-3`}>${c.values.map((v) => html`<div class="grid content-start gap-2 rounded-container bg-surface-raised p-6"><h2 class="type-heading-3">${v.title}</h2><p class="type-body text-fg-soft">${v.body}</p></div>`)}</section>`,
			roles: html`<section class=${`${WRAP} grid gap-8 pb-24`}><h2 class="type-section">${c.rolesTitle}</h2>${c.roles.length ? html`<ul role="list" class="m-0 list-none border-b border-edge p-0">${c.roles.map((r) => html`<li class="border-t border-edge"><a href=${r.href} class="group flex items-center gap-6 rounded-ds-sm py-6 transition-[color] duration-160 ease-out"><span class="grid flex-1 gap-1 sm:flex sm:items-baseline sm:justify-between sm:gap-6"><span class="type-heading-3 text-fg">${r.title}</span><span class="type-ui text-fg-muted">${r.team} · ${r.location}</span></span>${icon(ArrowUpRight, 'arrow-up-right', { size: 20, strokeWidth: 1.5, class: 'shrink-0 text-fg-muted transition-[color] duration-160 ease-out group-hover:text-fg', attrs: { 'aria-hidden': 'true' } })}</a></li>`)}</ul>` : html`<p class="type-body text-fg-soft">${c.none}</p>`}</section>`,
		}
		return html`<div data-ds="careers-page" class="flex min-h-dvh flex-col bg-surface text-fg"><spyglass-site-header .menus=${this.menus ?? headerMenus} .links=${h.header.nav} .secondary=${h.header.secondary} .cta=${h.header.cta}></spyglass-site-header><main class="flex-1">${pageSections(careersSections, this.sections).map((k) => parts[k])}</main><footer class="border-t border-edge"><div class=${`${WRAP} py-10`}><spyglass-footer-row domain=${h.footer.domain} home-href="/" .links=${h.footer.links}></spyglass-footer-row></div></footer></div>`
	}
}

define('careers-page', CareersPage)

Reference: Built from the library and the site's surfaces (cards on --surface, the rail on --raised, hairlines, the 36px links of the header).