Pages
Sign-in page
The site's sign-in and sign-up page: Black with the site's own light images in two corners bobbing slowly, two ASCII crops from 1024, the lockup bar, the form centered in the height left, and the proof row of marks under it.
Install
React apps get the React files; every other stack gets the web component.
npx spyglass-ds add auth-page<script type="module" src="/spyglass-ds/elements/auth-page.js"></script>Create your Acme account
500 free credits every month. No card required.
or
By continuing, you acknowledge that you understand and agree to the Terms & Conditions and Privacy Policy.
Already have an account? Sign in
Trusted by teams at
- Acme
- Acme Labs
- Acme Studio
- Acme Goods
- Acme Air
- Acme & Co
Welcome back
Sign in to your Acme account.
or
By continuing, you acknowledge that you understand and agree to the Terms & Conditions and Privacy Policy.
Don’t have an account? Sign up
Usage
Sign-in and sign-up screens; mode picks the copy, onProvider and onEmail (events in web components) take the presses.
Never
- A third-party logo shipped in the provider button or the proof row: pass the marks you may show
- More than one White button in a view
- Real people or customers in the copy: Acme only
- Light that keeps moving with reduced motion
sections lists the sections to show, in order (form, proof); a key left out is not shown.
Adds with it: ascii-drift, auth-form, creative-card, logo, proof-strip
Props
The web component takes the same as attributes or properties (<spyglass-auth-page>); title is heading there.
<AuthPage>
| Prop | Type | Default |
|---|---|---|
mode | AuthMode | 'sign-up' |
content | AuthContent | |
providerIcon | ReactNode The provider's mark, 20px, in the provider button. | |
onProvider | () => void | |
onEmail | (email: string) => void | |
logos | ProofLogo[] The proof row's marks. | proofPlaceholders |
proof | boolean Show the proof row (the site shows it on sign-up; sign-in keeps its room empty so the form sits as high). | mode === 'sign-up' |
sections | readonly AuthSection[] 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.
'use client'
import { KeyRound } from 'lucide-react'
import { AuthPage } from '@/react/components/pages/AuthPage'
// The sign-up page as the site sets it, with Acme's copy, a neutral mark in the provider button and Acme placeholder marks.
export default function SignUp() {
return <AuthPage mode="sign-up" providerIcon={<KeyRound size={20} strokeWidth={1.5} aria-hidden="true" />} onProvider={() => {}} onEmail={() => {}} />
}<!-- The sign-up page as the site sets it, with Acme's copy, a neutral mark in the provider button and Acme placeholder marks. -->
<spyglass-auth-page id="auth-up" mode="sign-up"><i slot="provider-icon" data-lucide="key-round" data-size="20" data-stroke-width="1.5" aria-hidden="true"></i></spyglass-auth-page>
<script type="module">
const page = document.getElementById('auth-up')
page.addEventListener('provider', (event) => event.preventDefault())
page.addEventListener('email', (event) => event.preventDefault())
</script>'use client'
import { KeyRound } from 'lucide-react'
import { AuthPage } from '@/react/components/pages/AuthPage'
// The sign-in page: the same page in its other mode.
export default function SignIn() {
return <AuthPage mode="sign-in" providerIcon={<KeyRound size={20} strokeWidth={1.5} aria-hidden="true" />} onProvider={() => {}} onEmail={() => {}} />
}<!-- The sign-in page: the same page in its other mode. -->
<spyglass-auth-page id="auth-in" mode="sign-in"><i slot="provider-icon" data-lucide="key-round" data-size="20" data-stroke-width="1.5" aria-hidden="true"></i></spyglass-auth-page>
<script type="module">
const page = document.getElementById('auth-in')
page.addEventListener('provider', (event) => event.preventDefault())
page.addEventListener('email', (event) => event.preventDefault())
</script>Source
import { type CSSProperties, type ReactNode, Fragment } from 'react'
import { AuthForm, type AuthMode } from '@/react/components/site/AuthForm'
import { ProofStrip, proofPlaceholders, type ProofLogo } from '@/react/components/site/ProofStrip'
import { Logo } from '@/react/components/visuals/Logo'
import { asciiDriftStyleObject } from '@/lib/ascii-drift'
import { authContent, type AuthContent, authSections, type AuthSection } from '@/lib/pages/auth'
import { AUTH_LIGHT_LEFT, AUTH_LIGHT_RIGHT, AUTH_LIGHT_RIGHT_PHONE } from '@/lib/textures'
import { cn } from '@/react/lib/cn'
import { pageSections } from '@/lib/image'
// The site's sign-in and sign-up pages (app/(auth), pages/Auth/AuthShell): Black with the brand light in two corners,
// the site's own pre-made light images (the top right one alone on phones), bobbing 12px back and forth over 14s on an
// ease that turns gently at both ends (still with reduced motion); from 1024 two crops of the ASCII texture fade in from
// the left at the top and the right at the bottom. A bar with the lockup (20px) over the form, centered in the height
// left, and on sign-up the proof row under it (sign-in keeps the room empty): "Trusted by teams at" over the marquee of marks (Acme placeholders; pass your own
// through `logos`). `providerIcon`, `onProvider` and `onEmail` go to the form.
export interface AuthPageProps {
mode?: AuthMode
content?: AuthContent
/** The provider's mark, 20px, in the provider button. */
providerIcon?: ReactNode
onProvider?: () => void
onEmail?: (email: string) => void
/** The proof row's marks. */
logos?: ProofLogo[]
/** Show the proof row (the site shows it on sign-up; sign-in keeps its room empty so the form sits as high). */
proof?: boolean
/** The sections to show, in order; all of them in the page order by default (leave one out to omit it). */
sections?: readonly AuthSection[]
className?: string
}
export function AuthPage({ mode = 'sign-up', content: c = authContent, providerIcon, onProvider, onEmail, logos = proofPlaceholders, proof = mode === 'sign-up', sections, className }: AuthPageProps) {
const parts: Record<AuthSection, ReactNode> = {
form: <AuthForm mode={mode} content={c} providerIcon={providerIcon} onProvider={onProvider} onEmail={onEmail} />,
proof: (
proof ? (
<section aria-label={c.proof} className="mx-auto flex min-h-(--ds-layout-auth-proof-h) w-full max-w-[calc(var(--ds-layout-auth-proof)+2*var(--ds-layout-gutter))] flex-col items-center gap-6 px-(--ds-layout-gutter)">
<h2 className="type-ui text-fg-muted">{c.proof}</h2>
<ProofStrip logos={logos} tight />
</section>
) : <div aria-hidden="true" className="mx-auto min-h-(--ds-layout-auth-proof-h) w-full" />
),
}
return (
<div data-ds="auth-page" className={cn('relative isolate grid min-h-svh grid-cols-[minmax(0,1fr)] grid-rows-[auto_1fr] overflow-clip bg-surface text-fg', className)}>
<style href="ds-auth-page" precedence="ds">{css}</style>
<div aria-hidden="true" className="pointer-events-none absolute inset-0 -z-1 overflow-clip">
<span className="ds-auth-light" data-side="left" style={{ backgroundImage: `url("${AUTH_LIGHT_LEFT}")` }} />
<span className="ds-auth-light" data-side="right" style={{ '--light-phone': `url("${AUTH_LIGHT_RIGHT_PHONE}")`, '--light': `url("${AUTH_LIGHT_RIGHT}")` } as CSSProperties} />
<span className="pointer-events-none absolute top-0 left-0 -z-1 hidden h-[44%] w-[36%] select-none lg:block" style={asciiDriftStyleObject('mass', 'left')} />
<span className="pointer-events-none absolute right-0 bottom-0 -z-1 hidden h-[44%] w-[36%] select-none lg:block" style={asciiDriftStyleObject('cluster', 'right')} />
</div>
<header className="relative z-1">
<div className="mx-auto flex h-16 w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] items-center px-(--ds-layout-gutter) lg:h-header">
<a href="/" aria-label={c.home} className="-ms-2 block rounded-ds-sm px-2 py-3 text-fg"><Logo height={20} /></a>
</div>
</header>
<main className="ds-auth-main flex min-w-0 flex-col justify-center gap-16 py-8">
{pageSections(authSections, sections).map((k) => <Fragment key={k}>{parts[k]}</Fragment>)}
</main>
</div>
)
}
export default AuthPage
const css = `
.ds-auth-light {
--w: calc(var(--ds-auth-light-w-phone) + 2 * var(--ds-auth-light-drift));
position: absolute; width: var(--w); aspect-ratio: 11 / 16;
background-position: center; background-size: 100% 100%; background-repeat: no-repeat;
rotate: var(--ds-auth-light-tilt); backface-visibility: hidden; will-change: transform;
animation: ds-auth-drift 14s var(--ds-easing-drift) infinite alternate;
}
.ds-auth-light[data-side="right"] { top: calc(-2 * var(--ds-auth-light-drift)); right: calc(-2 * var(--ds-auth-light-drift)); background-image: var(--light-phone); }
.ds-auth-light[data-side="left"] { --to-x: var(--ds-auth-light-drift); display: none; left: calc(-2 * var(--ds-auth-light-drift)); bottom: var(--ds-auth-light-left-rise); }
@keyframes ds-auth-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--to-x, calc(-1 * var(--ds-auth-light-drift))), var(--ds-auth-light-drift), 0); } }
@media (min-width: 768px) {
.ds-auth-light { --w: calc(var(--ds-auth-light-w) + 2 * var(--ds-auth-light-drift)); }
.ds-auth-light[data-side="left"] { display: block; }
.ds-auth-light[data-side="right"] { background-image: var(--light); }
}
@media (min-width: 768px) and (min-height: 820px) { .ds-auth-main { padding-bottom: calc(var(--ds-space-4xl) + var(--ds-space-2xl)); } }
@media (min-width: 1024px) and (min-height: 820px) { .ds-auth-main { padding-bottom: calc(var(--ds-size-header) + var(--ds-space-2xl)); } }
@media (prefers-reduced-motion: reduce) { .ds-auth-light { animation: none; } }
`// 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 { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import { asciiDriftStyle } from '@/lib/ascii-drift'
import { authContent, type AuthContent, authSections, type AuthSection } from '@/lib/pages/auth'
import { AUTH_LIGHT_LEFT, AUTH_LIGHT_RIGHT, AUTH_LIGHT_RIGHT_PHONE } from '@/lib/textures'
import { proofPlaceholders, type ProofLogo } from '@/elements/components/site/proof-strip'
import '@/elements/components/site/auth-form'
import '@/elements/components/site/proof-strip'
import '@/elements/components/visuals/logo'
import styles from 'virtual:tw'
import { pageSections } from '@/lib/image'
// AuthPage.tsx as <spyglass-auth-page>: the site's sign-in and sign-up pages, Black with the site's light images in two
// corners bobbing slowly (still with reduced motion), two ASCII crops from 1024, the lockup bar, the form centered in the
// height left and the proof row under it. `mode`, `content`, `logos` (JSON) and `proof` (the row, on sign-up by default); the provider's
// mark in the `provider-icon` slot; the form's `provider` and `email` events bubble out.
/**
* @summary The sign-in and sign-up page.
* @slot provider-icon - The provider's mark, 20px.
*/
export class AuthPage extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="auth-page"]'))
static properties = { mode: { reflect: true }, content: { type: Object }, logos: { type: Array }, proof: { type: Boolean }, sections: { type: Array } }
/** sign-in or sign-up. */
mode: 'sign-in' | 'sign-up' = 'sign-up'
/** The copy (lib/pages/auth.ts by default). */
content: AuthContent = authContent
/** The proof row's marks: { name, src?, ratio?, height? }. */
logos: ProofLogo[] = proofPlaceholders
/** Show the proof row; by default on sign-up only (sign-in keeps its room empty). */
proof?: boolean
/** The sections to show, in order (a list of names); all of them in the page order by default. */
sections?: AuthSection[]
render() {
const c = this.content ?? authContent
const logos = this.logos ?? proofPlaceholders
const icon = this.querySelector('[slot="provider-icon"]') ? html`<slot name="provider-icon" slot="provider-icon"></slot>` : nothing
const parts: Record<AuthSection, unknown> = {
form: html`<spyglass-auth-form mode=${this.mode} .content=${c}>${icon}</spyglass-auth-form>`,
proof: html`${(this.proof ?? this.mode === 'sign-up') ? html`<section aria-label=${c.proof} class="mx-auto flex min-h-(--ds-layout-auth-proof-h) w-full max-w-[calc(var(--ds-layout-auth-proof)+2*var(--ds-layout-gutter))] flex-col items-center gap-6 px-(--ds-layout-gutter)"><h2 class="type-ui text-fg-muted">${c.proof}</h2><spyglass-proof-strip .logos=${logos} tight></spyglass-proof-strip></section>` : html`<div aria-hidden="true" class="mx-auto min-h-(--ds-layout-auth-proof-h) w-full"></div>`}`,
}
return html`<div data-ds="auth-page" class="relative isolate grid min-h-svh grid-cols-[minmax(0,1fr)] grid-rows-[auto_1fr] overflow-clip bg-surface text-fg"><div aria-hidden="true" class="pointer-events-none absolute inset-0 -z-1 overflow-clip"><span class="ds-auth-light" data-side="left" style=${`background-image: url("${AUTH_LIGHT_LEFT}")`}></span><span class="ds-auth-light" data-side="right" style=${`--light-phone: url("${AUTH_LIGHT_RIGHT_PHONE}"); --light: url("${AUTH_LIGHT_RIGHT}")`}></span><span class="pointer-events-none absolute top-0 left-0 -z-1 hidden h-[44%] w-[36%] select-none lg:block" style=${asciiDriftStyle('mass', 'left')}></span><span class="pointer-events-none absolute right-0 bottom-0 -z-1 hidden h-[44%] w-[36%] select-none lg:block" style=${asciiDriftStyle('cluster', 'right')}></span></div><header class="relative z-1"><div class="mx-auto flex h-16 w-full max-w-[calc(var(--ds-layout-content)+2*var(--ds-layout-gutter))] items-center px-(--ds-layout-gutter) lg:h-header"><a href="/" aria-label=${c.home} class="-ms-2 block rounded-ds-sm px-2 py-3 text-fg"><spyglass-logo height="20"></spyglass-logo></a></div></header><main class="ds-auth-main flex min-w-0 flex-col justify-center gap-16 py-8">${pageSections(authSections, this.sections).map((k) => parts[k])}</main></div>`
}
}
define('auth-page', AuthPage).ds-auth-light {
--w: calc(var(--ds-auth-light-w-phone) + 2 * var(--ds-auth-light-drift));
position: absolute; width: var(--w); aspect-ratio: 11 / 16;
background-position: center; background-size: 100% 100%; background-repeat: no-repeat;
rotate: var(--ds-auth-light-tilt); backface-visibility: hidden; will-change: transform;
animation: ds-auth-drift 14s var(--ds-easing-drift) infinite alternate;
}
.ds-auth-light[data-side="right"] { top: calc(-2 * var(--ds-auth-light-drift)); right: calc(-2 * var(--ds-auth-light-drift)); background-image: var(--light-phone); }
.ds-auth-light[data-side="left"] { --to-x: var(--ds-auth-light-drift); display: none; left: calc(-2 * var(--ds-auth-light-drift)); bottom: var(--ds-auth-light-left-rise); }
@keyframes ds-auth-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--to-x, calc(-1 * var(--ds-auth-light-drift))), var(--ds-auth-light-drift), 0); } }
@media (min-width: 768px) {
.ds-auth-light { --w: calc(var(--ds-auth-light-w) + 2 * var(--ds-auth-light-drift)); }
.ds-auth-light[data-side="left"] { display: block; }
.ds-auth-light[data-side="right"] { background-image: var(--light); }
}
@media (min-width: 768px) and (min-height: 820px) { .ds-auth-main { padding-bottom: calc(var(--ds-space-4xl) + var(--ds-space-2xl)); } }
@media (min-width: 1024px) and (min-height: 820px) { .ds-auth-main { padding-bottom: calc(var(--ds-size-header) + var(--ds-space-2xl)); } }
@media (prefers-reduced-motion: reduce) { .ds-auth-light { animation: none; } }Reference: Site app/(auth) and pages/Auth (AuthShell, AuthForm, AuthProof, Auth.module.css): the lights public/brand/light/auth-light-*.webp at min(29vw, 520px) (144px, top right only, on phones), 11:16, bobbing 12px over 14s on --ease-drift; ASCII drifts 36% by 44% from 1024; the bar 64/72px with the 20px lockup; main centered with 64px between the form and the proof row, 32px in.