Scheduled maintenance
Planned downtime, which should not read like an error.
Live preview
Source
This exact file renders the preview above.
import { Clock, Wrench } from 'lucide-react'
import Link from 'next/link'
import { Container } from '@/components/ui/layout'
import { Progress } from '@/components/ui/progress'
import { Status } from '@/components/ui/status'
import { Alert } from '@/components/ui/alert'
/**
* Scheduled maintenance
*
* Planned downtime is not an error, and the page should not read like one. The
* two things people want are when it ends and where to watch — both are stated
* before anything else.
*/
export default function MaintenanceSection() {
return (
<section className="bg-canvas py-section">
<Container size="narrow" className="text-center">
<span className="mx-auto flex size-12 items-center justify-center rounded-full border border-line bg-surface text-accent">
<Wrench className="size-5" aria-hidden="true" />
</span>
<h1 className="display-type mt-6 text-2xl font-semibold text-ink-strong sm:text-3xl">
Back at 03:15 UTC
</h1>
<p className="mx-auto mt-3 max-w-md text-md text-ink-muted">
We are migrating the EU West region to new storage. The API is read-only until then.
</p>
<div className="mx-auto mt-8 max-w-md">
<Progress value={64} label="Migration progress" showValue />
<p className="mt-3 flex items-center justify-center gap-2 text-sm text-ink-muted">
<Clock className="size-4" aria-hidden="true" />
Started 02:30 UTC · about 20 minutes remaining
</p>
</div>
<div className="mx-auto mt-8 flex max-w-md flex-col gap-2 rounded-lg border border-line bg-surface p-5 text-left">
<p className="label-caps text-ink-subtle">Current status</p>
<Status appearance="dot" kind="pending" label="api.foundry.dev — read-only" />
<Status appearance="dot" kind="operational" label="cdn.foundry.dev — normal" />
<Status appearance="dot" kind="operational" label="docs.foundry.dev — normal" />
</div>
<Alert tone="info" className="mx-auto mt-6 max-w-md text-left">
Follow{' '}
<Link href="/changelog" className="font-medium underline underline-offset-4">
the changelog
</Link>{' '}
for updates. This is a template demo — nothing is actually under maintenance.
</Alert>
</Container>
</section>
)
}
components/blocks/sections/error/maintenance.tsx
import { Clock, Wrench } from 'lucide-react'
import Link from 'next/link'
import { Container } from '@/components/ui/layout'
import { Progress } from '@/components/ui/progress'
import { Status } from '@/components/ui/status'
import { Alert } from '@/components/ui/alert'
/**
* Scheduled maintenance
*
* Planned downtime is not an error, and the page should not read like one. The
* two things people want are when it ends and where to watch — both are stated
* before anything else.
*/
export default function MaintenanceSection() {
return (
<section className="bg-canvas py-section">
<Container size="narrow" className="text-center">
<span className="mx-auto flex size-12 items-center justify-center rounded-full border border-line bg-surface text-accent">
<Wrench className="size-5" aria-hidden="true" />
</span>
<h1 className="display-type mt-6 text-2xl font-semibold text-ink-strong sm:text-3xl">
Back at 03:15 UTC
</h1>
<p className="mx-auto mt-3 max-w-md text-md text-ink-muted">
We are migrating the EU West region to new storage. The API is read-only until then.
</p>
<div className="mx-auto mt-8 max-w-md">
<Progress value={64} label="Migration progress" showValue />
<p className="mt-3 flex items-center justify-center gap-2 text-sm text-ink-muted">
<Clock className="size-4" aria-hidden="true" />
Started 02:30 UTC · about 20 minutes remaining
</p>
</div>
<div className="mx-auto mt-8 flex max-w-md flex-col gap-2 rounded-lg border border-line bg-surface p-5 text-left">
<p className="label-caps text-ink-subtle">Current status</p>
<Status appearance="dot" kind="pending" label="api.foundry.dev — read-only" />
<Status appearance="dot" kind="operational" label="cdn.foundry.dev — normal" />
<Status appearance="dot" kind="operational" label="docs.foundry.dev — normal" />
</div>
<Alert tone="info" className="mx-auto mt-6 max-w-md text-left">
Follow{' '}
<Link href="/changelog" className="font-medium underline underline-offset-4">
the changelog
</Link>{' '}
for updates. This is a template demo — nothing is actually under maintenance.
</Alert>
</Container>
</section>
)
}
components/ui/progress.tsx
import { cn } from '@/lib/cn'
/**
* Progress
*
* Determinate by default. When `value` is omitted the bar renders as
* indeterminate and drops `aria-valuenow`, which is what tells assistive tech
* "in progress, duration unknown" rather than "0%".
*/
export interface ProgressProps {
/** 0–100. Omit for an indeterminate bar. */
value?: number
label?: string
/** Renders the numeric value beside the label. */
showValue?: boolean
/** Accessible name when no visible label is wanted. */
srLabel?: string
tone?: 'accent' | 'success' | 'warning' | 'danger'
size?: 'sm' | 'md'
className?: string
}
const tones = {
accent: 'bg-accent',
success: 'bg-success',
warning: 'bg-warning',
danger: 'bg-danger',
} as const
export function Progress({
value,
label,
showValue = false,
srLabel,
tone = 'accent',
size = 'md',
className,
}: ProgressProps) {
const clamped = value === undefined ? undefined : Math.max(0, Math.min(100, Math.round(value)))
return (
<div className={cn('w-full', className)}>
{(label || showValue) && (
<div className="mb-1.5 flex items-baseline justify-between gap-3">
{label ? <span className="text-xs font-medium text-ink">{label}</span> : <span />}
{showValue && clamped !== undefined ? (
<span className="font-mono text-xs text-ink-muted tabular-nums">{clamped}%</span>
) : null}
</div>
)}
<div
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={clamped}
aria-label={label ? undefined : (srLabel ?? 'Progress')}
aria-valuetext={clamped === undefined ? 'In progress' : `${clamped}%`}
className={cn(
'w-full overflow-hidden rounded-full bg-surface-sunken',
size === 'sm' ? 'h-1' : 'h-2',
)}
>
{clamped === undefined ? (
<div className={cn('h-full w-2/5 animate-pulse-token rounded-full', tones[tone])} />
) : (
<div
className={cn(
'h-full rounded-full transition-[width] duration-300 ease-standard',
tones[tone],
)}
style={{ width: `${clamped}%` }}
/>
)}
</div>
</div>
)
}
export interface ProgressRingProps {
value: number
size?: number
label?: string
tone?: keyof typeof tones
className?: string
}
/** Circular variant, for dashboard tiles where a bar would waste width. */
export function ProgressRing({
value,
size = 56,
label,
tone = 'accent',
className,
}: ProgressRingProps) {
const clamped = Math.max(0, Math.min(100, Math.round(value)))
const stroke = 5
const radius = (size - stroke) / 2
const circumference = 2 * Math.PI * radius
const offset = circumference - (clamped / 100) * circumference
const strokeColor = {
accent: 'var(--color-accent)',
success: 'var(--color-success)',
warning: 'var(--color-warning)',
danger: 'var(--color-danger)',
}[tone]
return (
<div
className={cn('relative inline-flex items-center justify-center', className)}
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={clamped}
aria-label={label ?? 'Progress'}
>
<svg width={size} height={size} className="-rotate-90" aria-hidden="true">
<circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke="var(--color-surface-sunken)"
strokeWidth={stroke}
/>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke={strokeColor}
strokeWidth={stroke}
strokeLinecap="round"
strokeDasharray={circumference}
strokeDashoffset={offset}
/>
</svg>
<span className="absolute font-mono text-xs font-medium tabular-nums">{clamped}%</span>
</div>
)
}
components/ui/status.tsx
import { CheckCircle2, AlertTriangle, XCircle, Info, CircleDashed, Clock } from 'lucide-react'
import { cn } from '@/lib/cn'
/**
* Status
*
* Deliberately separate from Badge. A status describes the *state of a thing*
* (a deployment, an invoice, a service) and therefore always pairs an icon
* with a label — colour is the third signal, never the only one. That rule is
* what makes the library legible to colour-blind users without a theme switch.
*/
export type StatusKind = 'operational' | 'degraded' | 'down' | 'pending' | 'info' | 'idle'
export interface StatusProps {
kind: StatusKind
label: string
/** `dot` for dense tables, `pill` for standalone display. */
appearance?: 'dot' | 'pill' | 'inline'
className?: string
}
const config = {
operational: {
icon: CheckCircle2,
text: 'text-success',
bg: 'bg-success-soft border-success-line',
dot: 'bg-success',
},
degraded: {
icon: AlertTriangle,
text: 'text-warning',
bg: 'bg-warning-soft border-warning-line',
dot: 'bg-warning',
},
down: {
icon: XCircle,
text: 'text-danger',
bg: 'bg-danger-soft border-danger-line',
dot: 'bg-danger',
},
pending: { icon: Clock, text: 'text-info', bg: 'bg-info-soft border-info-line', dot: 'bg-info' },
info: { icon: Info, text: 'text-info', bg: 'bg-info-soft border-info-line', dot: 'bg-info' },
idle: {
icon: CircleDashed,
text: 'text-ink-subtle',
bg: 'bg-surface-sunken border-line',
dot: 'bg-ink-subtle',
},
} as const
export function Status({ kind, label, appearance = 'inline', className }: StatusProps) {
const entry = config[kind]
const Icon = entry.icon
if (appearance === 'dot') {
return (
<span className={cn('inline-flex items-center gap-2 text-sm text-ink', className)}>
<span className={cn('size-2 shrink-0 rounded-full', entry.dot)} aria-hidden="true" />
{label}
</span>
)
}
if (appearance === 'pill') {
return (
<span
className={cn(
'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium',
entry.bg,
entry.text,
className,
)}
>
<Icon className="size-3.5 shrink-0" aria-hidden="true" />
{label}
</span>
)
}
return (
<span
className={cn('inline-flex items-center gap-1.5 text-sm font-medium', entry.text, className)}
>
<Icon className="size-4 shrink-0" aria-hidden="true" />
{label}
</span>
)
}
Demo source — adapt to your project. Foundry is not published as a package.
Usage
The two things people want are when it ends and where to watch. Both are stated before anything else.
- Lead with the return time, not with an apology.
- Show which services are unaffected; partial availability is the usual reality.
Variants and states
Every entry below is a genuine difference in behaviour or layout, and every one of them is visible in the preview above.
- Return time
- Progress bar
- Per-service status
Accessibility
- Progress semantics
- The migration bar is a real progressbar with a value.
- Status list
- Per-service state uses icon and word, never colour alone.
Foundry implements published ARIA patterns and is tested against them. No WCAG certification is claimed — see the accessibility documentation for what is and is not covered.
Related
All sectionsOffline state
Subscribes to real online and offline events rather than pretending.
intermediate3 variantsService status overview
Per-service health with a summary derived from the services below it.
starter3 variants500 section
A server failure with a reference code and a real retry button.
starter3 variants