refactor(status-page): convert bold, modern and editorial themes to MUI sx

Finishes the migration started for refined. Each theme now consumes the same pattern:

- A typed *Styles interface that names every entry the page consumes (no `as Function` casts at the call site)
- A *Styles factory that takes (tokens, isDark) and returns sx recipes derived from existing tokens.ts plus the shared toneColor/toneSoft helpers in shared/overallStatus
- A useMemo around the factory call so MUI's sx processor sees referential equality across renders that don't change tokens
- modern.css's keyframes (pulse + staggered fade-in + reduced-motion guard) ported via @mui/system keyframes inside the modern styles factory
- bold.css's hero glow + conic logo + pseudo-elements ported as inline sx via "&::before" / "& > *" selectors
- editorial.css's serif typography + hairline dividers + flat rectangular badges ported as plain sx with the serif/sans family stacks named at module scope

Drop the four .css files (~1789 lines) along with the className= attributes and the import "./*.css" lines in each StatusPage component.

The shared themed components (ThemedHeatmap, ThemedHistogram, ThemedInfrastructure) lose their legacy classPrefix branch entirely now that no theme uses it. The dual-API gate is gone; there is one path.

Verified: tsc --noEmit clean, prettier clean.

Note: theme-overrides.css remains for the legacy non-themed status page components (StatusBar, MonitorsList, HeaderStatusPageControls). That's separate scope from the four-theme work the reviewer flagged; can be migrated in a follow-up.
This commit is contained in:
gorkem-bwl committed 2026-04-27 18:39:42 -04:00
1 parent b95d8886b9
commit c6c50063d8
12 files changed
+1442 -1616

No files matched your search

@@ -1,4 +1,4 @@
import { useState } from "react";
import { useMemo, useState } from "react";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import { useTranslation } from "react-i18next";
@@ -14,7 +14,8 @@ import {
resolveOverallStatus,
statusBadgeKey,
} from "../shared/overallStatus";
import "./modern.css";
import { useStatusPageTheme } from "../StatusPageThemeProvider";
import { modernStyles } from "./styles";
type StatusPageMonitor = Monitor & { checks?: Monitor["recentChecks"] };
@@ -23,10 +24,10 @@ interface Props {
monitors: StatusPageMonitor[];
}
const PREFIX = "mod";
export const ModernStatusPage = ({ statusPage, monitors }: Props) => {
const { t } = useTranslation();
const { tokens, mode } = useStatusPageTheme();
const styles = useMemo(() => modernStyles(tokens, mode === "dark"), [tokens, mode]);
const [chartMode, setChartMode] = useState<"heatmap" | "histogram">("heatmap");
const overall = resolveOverallStatus(monitors, t, { iconSize: 20 });
@@ -35,72 +36,85 @@ export const ModernStatusPage = ({ statusPage, monitors }: Props) => {
: null;
return (
<Box className={`${PREFIX}-page`}>
<Box sx={styles.page}>
<Box
component="header"
className={`${PREFIX}-top`}
sx={styles.top}
>
<Box className={`${PREFIX}-brand`}>
<Box sx={styles.brand}>
{logoSrc ? (
<Box
component="img"
src={logoSrc}
alt={statusPage.companyName}
className={`${PREFIX}-logo-img`}
sx={styles.logoImg}
/>
) : (
<Box className={`${PREFIX}-logo-grad`}>
{monoFirstChar(statusPage.companyName)}
</Box>
<Box sx={styles.logoGrad}>{monoFirstChar(statusPage.companyName)}</Box>
)}
<span className={`${PREFIX}-company`}>{statusPage.companyName}</span>
<Box
component="span"
sx={styles.company}
>
{statusPage.companyName}
</Box>
</Box>
</Box>
<Box className={`${PREFIX}-hero ${PREFIX}-tone-${overall.tone}`}>
<Box className={`${PREFIX}-pulse`} />
<Box className={`${PREFIX}-status-copy`}>
<h1 className={`${PREFIX}-hero-title`}>{overall.message}</h1>
<p className={`${PREFIX}-hero-sub`}>
<Box sx={styles.hero}>
<Box sx={styles.pulse(overall.tone)} />
<Box sx={styles.statusCopy}>
<Box
component="h1"
sx={styles.heroTitle}
>
{overall.message}
</Box>
<Box
component="p"
sx={styles.heroSub}
>
{t("pages.statusPages.statusBar.monitoringSummary", {
count: monitors.length,
})}
</p>
</Box>
</Box>
<Box className={`${PREFIX}-hero-icon`}>{overall.icon}</Box>
<Box sx={styles.heroIcon(overall.tone)}>{overall.icon}</Box>
</Box>
{statusPage.showCharts && (
<Box className={`${PREFIX}-chart-switch-wrap`}>
<Box sx={styles.chartSwitchWrap}>
<Box
className={`${PREFIX}-chart-switch`}
sx={styles.chartSwitch}
role="radiogroup"
>
<button
<Box
component="button"
type="button"
role="radio"
aria-checked={chartMode === "heatmap"}
className={chartMode === "heatmap" ? `${PREFIX}-active` : ""}
onClick={() => setChartMode("heatmap")}
sx={styles.chartSwitchButton(chartMode === "heatmap")}
>
{t("pages.statusPages.monitorsList.chartTypeHeatmap")}
</button>
<button
</Box>
<Box
component="button"
type="button"
role="radio"
aria-checked={chartMode === "histogram"}
className={chartMode === "histogram" ? `${PREFIX}-active` : ""}
onClick={() => setChartMode("histogram")}
sx={styles.chartSwitchButton(chartMode === "histogram")}
>
{t("pages.statusPages.monitorsList.chartTypeHistogram")}
</button>
</Box>
</Box>
</Box>
)}
<Stack
component="ul"
className={`${PREFIX}-monitor-list`}
sx={styles.monitorList}
>
{monitors.map((monitor) => {
const isHardware = monitor.type === "hardware";
@@ -112,48 +126,65 @@ export const ModernStatusPage = ({ statusPage, monitors }: Props) => {
<Box
component="li"
key={monitor.id}
className={`${PREFIX}-card ${PREFIX}-card-${monitor.status}`}
sx={styles.card}
>
<Box className={`${PREFIX}-card-row`}>
<Box className={`${PREFIX}-card-left`}>
<Box className={`${PREFIX}-monitor-name`}>{monitor.name}</Box>
<Box className={`${PREFIX}-monitor-meta`}>
<span
className={`${PREFIX}-pill ${PREFIX}-pill-${isHardware ? "hardware" : "default"}`}
<Box sx={styles.cardRow}>
<Box sx={styles.cardLeft}>
<Box sx={styles.monitorName}>{monitor.name}</Box>
<Box sx={styles.monitorMeta}>
<Box
component="span"
sx={isHardware ? styles.pillHardware : styles.pill}
>
{getMonitorTypeLabel(monitor.type, t)}
</span>
</Box>
{monitor.url && (
<span
className={`${PREFIX}-monitor-url`}
<Box
component="span"
sx={styles.monitorUrl}
title={monitor.url}
>
{monitor.url}
</span>
</Box>
)}
</Box>
</Box>
<span className={`${PREFIX}-badge ${PREFIX}-badge-${badgeTone}`}>
<Box
component="span"
sx={styles.badge(badgeTone)}
>
{t(statusBadgeKey[monitor.status])}
</span>
</Box>
</Box>
{showInfra && (
<ThemedInfrastructure
monitor={monitor}
classPrefix={PREFIX}
sxApi={{
containerSx: styles.infra,
emptySx: styles.infraEmpty,
gaugeSx: styles.gauge,
gaugeLabelSx: styles.gaugeLabel,
gaugeValueSx: styles.gaugeValue,
gaugeBarSx: styles.gaugeBar,
gaugeFillSx: styles.gaugeFill,
gaugeSubSx: styles.gaugeSub,
}}
/>
)}
{showChart &&
(chartMode === "heatmap" ? (
<ThemedHeatmap
checks={monitor.recentChecks ?? []}
classPrefix={PREFIX}
containerSx={styles.heatmap}
cellSx={styles.heatmapCell}
/>
) : (
<ThemedHistogram
checks={monitor.recentChecks ?? []}
classPrefix={PREFIX}
containerSx={styles.histogram}
barSx={styles.bar}
statsSx={styles.chartStats}
/>
))}
</Box>
@@ -163,7 +194,7 @@ export const ModernStatusPage = ({ statusPage, monitors }: Props) => {
<Box
component="footer"
className={`${PREFIX}-footer`}
sx={styles.footer}
>
{t("pages.statusPages.footer.poweredBy")}{" "}
<a
@@ -1,519 +0,0 @@
/*
* Modern theme — scoped to [data-status-theme="modern"].
* Port of /Users/gorkemcetin/Desktop/checkmate-status-mockups/02-modern.html.
* Signature traits: gradient logo, pulsing status dot, gradient border +
* radial glow on the hero, 16px rounded cards with strong shadow and
* staggered fade-in on mount, gradient-filled chart bars, 4-column
* gauge row with gradient backgrounds.
*/
[data-status-theme="modern"]:not([data-status-transparent]) {
display: flex;
flex-direction: column;
min-height: 100vh;
background: var(--sp-bg);
}
[data-status-theme="modern"] .mod-page {
flex: 1 0 auto;
max-width: 980px;
width: 100%;
margin: 0 auto;
padding: 56px 20px 80px;
font:
14px/1.5 -apple-system,
BlinkMacSystemFont,
"Inter",
"Segoe UI",
Roboto,
sans-serif;
color: var(--sp-text);
-webkit-font-smoothing: antialiased;
}
/* --- header / brand --- */
[data-status-theme="modern"] .mod-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 32px;
}
[data-status-theme="modern"] .mod-brand {
display: flex;
align-items: center;
gap: 12px;
font-weight: 700;
font-size: 15px;
letter-spacing: -0.01em;
color: var(--sp-text);
}
[data-status-theme="modern"] .mod-logo-grad {
width: 32px;
height: 32px;
border-radius: 10px;
background: linear-gradient(135deg, var(--sp-up), var(--sp-up-strong));
display: grid;
place-items: center;
color: #fff;
font-weight: 700;
font-size: 14px;
box-shadow: 0 4px 10px color-mix(in srgb, var(--sp-up) 40%, transparent);
}
[data-status-theme="modern"] .mod-logo-img {
max-height: 32px;
max-width: 120px;
object-fit: contain;
}
/* --- hero: clean flat card with pulsing dot (the signature motion) --- */
[data-status-theme="modern"] .mod-hero {
position: relative;
border-radius: 20px;
padding: 28px 32px;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 20px;
background: var(--sp-surface);
border: 1px solid var(--sp-border);
box-shadow:
0 2px 4px rgba(16, 24, 40, 0.04),
0 12px 32px rgba(16, 24, 40, 0.06);
}
[data-status-theme="modern"][data-status-mode="dark"] .mod-hero {
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.5),
0 20px 40px rgba(0, 0, 0, 0.4);
}
[data-status-theme="modern"] .mod-pulse {
position: relative;
width: 14px;
height: 14px;
border-radius: 50%;
background: var(--sp-up);
flex-shrink: 0;
}
[data-status-theme="modern"] .mod-hero.mod-tone-warn .mod-pulse {
background: var(--sp-warn);
}
[data-status-theme="modern"] .mod-hero.mod-tone-down .mod-pulse {
background: var(--sp-down);
}
[data-status-theme="modern"] .mod-pulse::before,
[data-status-theme="modern"] .mod-pulse::after {
content: "";
position: absolute;
inset: 0;
border-radius: 50%;
background: currentColor;
opacity: 0.5;
animation: mod-pulse 2s ease-out infinite;
}
[data-status-theme="modern"] .mod-pulse::after {
animation-delay: 1s;
}
[data-status-theme="modern"] .mod-pulse {
color: var(--sp-up);
}
[data-status-theme="modern"] .mod-hero.mod-tone-warn .mod-pulse {
color: var(--sp-warn);
}
[data-status-theme="modern"] .mod-hero.mod-tone-down .mod-pulse {
color: var(--sp-down);
}
@keyframes mod-pulse {
0% {
transform: scale(1);
opacity: 0.5;
}
100% {
transform: scale(2.4);
opacity: 0;
}
}
[data-status-theme="modern"] .mod-status-copy {
flex: 1;
min-width: 0;
}
[data-status-theme="modern"] .mod-hero-title {
margin: 0 0 4px;
font-size: 22px;
font-weight: 700;
letter-spacing: -0.02em;
color: var(--sp-text);
}
[data-status-theme="modern"] .mod-hero-sub {
margin: 0;
color: var(--sp-text-muted);
font-size: 13px;
}
[data-status-theme="modern"] .mod-hero-icon {
color: var(--sp-text-muted);
display: flex;
align-items: center;
}
[data-status-theme="modern"] .mod-hero.mod-tone-up .mod-hero-icon {
color: var(--sp-up);
}
[data-status-theme="modern"] .mod-hero.mod-tone-warn .mod-hero-icon {
color: var(--sp-warn);
}
[data-status-theme="modern"] .mod-hero.mod-tone-down .mod-hero-icon {
color: var(--sp-down);
}
/* --- chart toggle (rounded segmented control) --- */
[data-status-theme="modern"] .mod-chart-switch-wrap {
display: flex;
justify-content: flex-end;
margin-bottom: 14px;
}
[data-status-theme="modern"] .mod-chart-switch {
display: inline-flex;
border: 1px solid var(--sp-border);
border-radius: 999px;
background: var(--sp-surface);
padding: 3px;
gap: 2px;
}
[data-status-theme="modern"] .mod-chart-switch > button {
border: 0;
background: transparent;
font: inherit;
font-size: 11px;
padding: 6px 16px;
cursor: pointer;
color: var(--sp-text-muted);
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.08em;
transition:
background 0.2s,
color 0.2s;
border-radius: 999px;
}
[data-status-theme="modern"] .mod-chart-switch > button:hover {
color: var(--sp-text);
}
[data-status-theme="modern"] .mod-chart-switch > button.mod-active {
color: var(--sp-up);
background: var(--sp-up-soft);
}
/* --- cards: 16px radius, strong shadow, staggered fade-in, hover lift --- */
[data-status-theme="modern"] .mod-monitor-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 14px;
}
[data-status-theme="modern"] .mod-card {
background: var(--sp-surface);
border: 1px solid var(--sp-border);
border-radius: 16px;
box-shadow:
0 2px 4px rgba(16, 24, 40, 0.04),
0 12px 32px rgba(16, 24, 40, 0.06);
overflow: hidden;
transition:
transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
box-shadow 0.2s;
opacity: 0;
transform: translateY(8px);
animation: mod-fadein 0.5s forwards;
}
[data-status-theme="modern"][data-status-mode="dark"] .mod-card {
box-shadow:
0 2px 6px rgba(0, 0, 0, 0.5),
0 20px 40px rgba(0, 0, 0, 0.4);
}
[data-status-theme="modern"] .mod-card:nth-child(1) {
animation-delay: 0.05s;
}
[data-status-theme="modern"] .mod-card:nth-child(2) {
animation-delay: 0.1s;
}
[data-status-theme="modern"] .mod-card:nth-child(3) {
animation-delay: 0.15s;
}
[data-status-theme="modern"] .mod-card:nth-child(4) {
animation-delay: 0.2s;
}
[data-status-theme="modern"] .mod-card:nth-child(5) {
animation-delay: 0.25s;
}
[data-status-theme="modern"] .mod-card:nth-child(n + 6) {
animation-delay: 0.3s;
}
@keyframes mod-fadein {
to {
opacity: 1;
transform: translateY(0);
}
}
[data-status-theme="modern"] .mod-card:hover {
transform: translateY(-2px);
box-shadow:
0 4px 8px rgba(16, 24, 40, 0.05),
0 16px 40px rgba(16, 24, 40, 0.08);
}
[data-status-theme="modern"] .mod-card-row {
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
gap: 20px;
padding: 18px 24px;
}
[data-status-theme="modern"] .mod-card-left {
min-width: 0;
}
[data-status-theme="modern"] .mod-monitor-name {
font-weight: 600;
font-size: 15px;
letter-spacing: -0.005em;
color: var(--sp-text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
[data-status-theme="modern"] .mod-monitor-meta {
display: flex;
gap: 10px;
align-items: center;
margin-top: 6px;
flex-wrap: wrap;
}
[data-status-theme="modern"] .mod-pill {
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--sp-text-muted);
background: var(--sp-bg);
padding: 3px 9px;
border-radius: 999px;
font-weight: 600;
}
[data-status-theme="modern"] .mod-pill-hardware {
color: #2563eb;
background: rgba(37, 99, 235, 0.1);
}
[data-status-theme="modern"][data-status-mode="dark"] .mod-pill-hardware {
color: #60a5fa;
background: rgba(96, 165, 250, 0.15);
}
[data-status-theme="modern"] .mod-monitor-url {
font-size: 12px;
color: var(--sp-text-muted);
font-family: ui-monospace, Menlo, monospace;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 280px;
}
/* --- badge: with inner dot --- */
[data-status-theme="modern"] .mod-badge {
font-size: 11px;
font-weight: 700;
padding: 5px 12px;
border-radius: 999px;
display: inline-flex;
align-items: center;
gap: 6px;
white-space: nowrap;
}
[data-status-theme="modern"] .mod-badge::before {
content: "";
width: 6px;
height: 6px;
border-radius: 50%;
background: currentColor;
}
[data-status-theme="modern"] .mod-badge-up {
background: var(--sp-up-soft);
color: var(--sp-up);
}
[data-status-theme="modern"] .mod-badge-warn {
background: var(--sp-warn-soft);
color: var(--sp-warn);
}
[data-status-theme="modern"] .mod-badge-down {
background: var(--sp-down-soft);
color: var(--sp-down);
}
/* --- heatmap with gradient cells --- */
[data-status-theme="modern"] .mod-heatmap {
padding: 0 24px 20px;
display: grid;
grid-template-columns: repeat(25, 1fr);
gap: 3px;
height: 46px;
}
[data-status-theme="modern"] .mod-heatmap-cell {
border-radius: 3px;
background: var(--sp-up);
transition: transform 0.15s;
}
[data-status-theme="modern"] .mod-heatmap-cell:hover {
transform: scaleY(1.2);
}
[data-status-theme="modern"] .mod-heatmap-cell.mod-fast {
background: linear-gradient(180deg, var(--sp-up), var(--sp-up-strong));
}
[data-status-theme="modern"] .mod-heatmap-cell.mod-med {
background: linear-gradient(
180deg,
color-mix(in srgb, var(--sp-up) 70%, #ffffff 30%),
var(--sp-up)
);
}
[data-status-theme="modern"] .mod-heatmap-cell.mod-slow {
background: linear-gradient(180deg, var(--sp-warn), var(--sp-degraded));
}
[data-status-theme="modern"] .mod-heatmap-cell.mod-down {
background: linear-gradient(
180deg,
var(--sp-down),
color-mix(in srgb, var(--sp-down) 70%, #000000 30%)
);
}
[data-status-theme="modern"] .mod-heatmap-cell.mod-empty {
background: var(--sp-border);
opacity: 0.4;
}
/* --- histogram with gradient bars --- */
[data-status-theme="modern"] .mod-histogram {
padding: 0 24px;
display: grid;
grid-template-columns: repeat(25, 1fr);
gap: 3px;
align-items: flex-end;
height: 46px;
}
[data-status-theme="modern"] .mod-bar {
background: var(--sp-up);
border-radius: 3px;
min-height: 4px;
transition: transform 0.15s;
}
[data-status-theme="modern"] .mod-bar:hover {
transform: scaleY(1.08);
}
[data-status-theme="modern"] .mod-bar.mod-down {
background: var(--sp-down);
}
[data-status-theme="modern"] .mod-bar.mod-empty {
background: var(--sp-border);
opacity: 0.4;
}
[data-status-theme="modern"] .mod-chart-stats {
padding: 0 24px 20px;
font-size: 11px;
color: var(--sp-text-muted);
font-variant-numeric: tabular-nums;
font-weight: 600;
}
/* --- infra gauges: 3-col (4 if temp present), gradient surfaces --- */
[data-status-theme="modern"] .mod-infra {
padding: 16px 24px 22px;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 14px;
}
@media (max-width: 720px) {
[data-status-theme="modern"] .mod-infra {
grid-template-columns: 1fr;
}
}
[data-status-theme="modern"] .mod-infra-empty {
padding: 16px 24px 22px;
color: var(--sp-text-muted);
font-size: 13px;
}
[data-status-theme="modern"] .mod-gauge {
border: 1px solid var(--sp-border);
border-radius: 14px;
padding: 14px 16px;
background: linear-gradient(135deg, var(--sp-bg), var(--sp-surface));
}
[data-status-theme="modern"] .mod-gauge-label {
font-size: 10px;
color: var(--sp-text-muted);
text-transform: uppercase;
letter-spacing: 0.1em;
font-weight: 700;
}
[data-status-theme="modern"] .mod-gauge-value {
font-size: 26px;
font-weight: 700;
letter-spacing: -0.02em;
margin-top: 4px;
font-variant-numeric: tabular-nums;
color: var(--sp-text);
}
[data-status-theme="modern"] .mod-gauge-bar {
height: 6px;
background: var(--sp-border);
border-radius: 3px;
overflow: hidden;
margin-top: 10px;
}
[data-status-theme="modern"] .mod-gauge-fill {
display: block;
height: 100%;
background: linear-gradient(90deg, var(--sp-up), var(--sp-up-strong));
border-radius: 3px;
transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
[data-status-theme="modern"] .mod-gauge-fill.mod-warm {
background: linear-gradient(90deg, var(--sp-warn), var(--sp-degraded));
}
[data-status-theme="modern"] .mod-gauge-fill.mod-hot {
background: linear-gradient(
90deg,
var(--sp-down),
color-mix(in srgb, var(--sp-down) 70%, #000000 30%)
);
}
[data-status-theme="modern"] .mod-gauge-sub {
font-size: 11px;
color: var(--sp-text-muted);
margin-top: 8px;
font-variant-numeric: tabular-nums;
}
/* --- footer --- */
[data-status-theme="modern"] .mod-footer {
text-align: center;
color: var(--sp-text-muted);
font-size: 12px;
margin-top: 48px;
}
[data-status-theme="modern"] .mod-footer a {
color: var(--sp-up);
text-decoration: underline;
text-underline-offset: 3px;
font-weight: 700;
}
[data-status-theme="modern"] .mod-footer a:hover {
color: var(--sp-up-strong);
}
/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
[data-status-theme="modern"] .mod-card {
animation: none;
opacity: 1;
transform: none;
}
[data-status-theme="modern"] .mod-pulse::before,
[data-status-theme="modern"] .mod-pulse::after {
animation: none;
}
}
@@ -0,0 +1,431 @@
import type { SxProps, Theme } from "@mui/material/styles";
import { keyframes } from "@mui/system";
import type { StatusPageThemeTokens } from "../tokens";
import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus";
export type ModernHeatCell = "fast" | "med" | "slow" | "down" | "empty";
export type ModernBarKind = "up" | "down" | "empty";
export type ModernGaugeFill = "ok" | "warm" | "hot";
export interface ModernStyles {
page: SxProps<Theme>;
top: SxProps<Theme>;
brand: SxProps<Theme>;
logoGrad: SxProps<Theme>;
logoImg: SxProps<Theme>;
company: SxProps<Theme>;
hero: SxProps<Theme>;
pulse: (tone: OverallTone) => SxProps<Theme>;
statusCopy: SxProps<Theme>;
heroTitle: SxProps<Theme>;
heroSub: SxProps<Theme>;
heroIcon: (tone: OverallTone) => SxProps<Theme>;
chartSwitchWrap: SxProps<Theme>;
chartSwitch: SxProps<Theme>;
chartSwitchButton: (active: boolean) => SxProps<Theme>;
monitorList: SxProps<Theme>;
card: SxProps<Theme>;
cardRow: SxProps<Theme>;
cardLeft: SxProps<Theme>;
monitorName: SxProps<Theme>;
monitorMeta: SxProps<Theme>;
pill: SxProps<Theme>;
pillHardware: SxProps<Theme>;
monitorUrl: SxProps<Theme>;
badge: (tone: OverallTone) => SxProps<Theme>;
heatmap: SxProps<Theme>;
heatmapCell: (kind: ModernHeatCell) => SxProps<Theme>;
histogram: SxProps<Theme>;
bar: (kind: ModernBarKind, heightPct: number) => SxProps<Theme>;
chartStats: SxProps<Theme>;
infra: SxProps<Theme>;
infraEmpty: SxProps<Theme>;
gauge: SxProps<Theme>;
gaugeLabel: SxProps<Theme>;
gaugeValue: SxProps<Theme>;
gaugeBar: SxProps<Theme>;
gaugeFill: (level: ModernGaugeFill, widthPct: number) => SxProps<Theme>;
gaugeSub: SxProps<Theme>;
footer: SxProps<Theme>;
}
const sansFontStack =
'-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif';
const lightShadow =
"0 2px 4px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.06)";
const darkShadow = "0 2px 6px rgba(0, 0, 0, 0.5), 0 20px 40px rgba(0, 0, 0, 0.4)";
const lightShadowHover =
"0 4px 8px rgba(16, 24, 40, 0.05), 0 16px 40px rgba(16, 24, 40, 0.08)";
const pulseKeyframes = keyframes`
0% { transform: scale(1); opacity: 0.5; }
100% { transform: scale(2.4); opacity: 0; }
`;
const fadeInKeyframes = keyframes`
to { opacity: 1; transform: translateY(0); }
`;
export const modernStyles = (
tokens: StatusPageThemeTokens,
isDark: boolean
): ModernStyles => {
const cardShadow = isDark ? darkShadow : lightShadow;
const heatCellBg: Record<ModernHeatCell, string> = {
fast: `linear-gradient(180deg, ${tokens.up}, ${tokens.upStrong})`,
med: `linear-gradient(180deg, color-mix(in srgb, ${tokens.up} 70%, #ffffff 30%), ${tokens.up})`,
slow: `linear-gradient(180deg, ${tokens.warn}, ${tokens.degraded})`,
down: `linear-gradient(180deg, ${tokens.down}, color-mix(in srgb, ${tokens.down} 70%, #000000 30%))`,
empty: tokens.border,
};
const barBg: Record<ModernBarKind, string> = {
up: tokens.up,
down: tokens.down,
empty: tokens.border,
};
const gaugeFillBg: Record<ModernGaugeFill, string> = {
ok: `linear-gradient(90deg, ${tokens.up}, ${tokens.upStrong})`,
warm: `linear-gradient(90deg, ${tokens.warn}, ${tokens.degraded})`,
hot: `linear-gradient(90deg, ${tokens.down}, color-mix(in srgb, ${tokens.down} 70%, #000000 30%))`,
};
return {
page: {
flex: "1 0 auto",
maxWidth: 980,
width: "100%",
mx: "auto",
p: "56px 20px 80px",
fontFamily: sansFontStack,
fontSize: 14,
lineHeight: 1.5,
color: tokens.text,
WebkitFontSmoothing: "antialiased",
},
top: {
display: "flex",
alignItems: "center",
justifyContent: "space-between",
mb: "32px",
},
brand: {
display: "flex",
alignItems: "center",
gap: "12px",
fontWeight: 700,
fontSize: 15,
letterSpacing: "-0.01em",
color: tokens.text,
},
logoGrad: {
width: 32,
height: 32,
borderRadius: "10px",
background: `linear-gradient(135deg, ${tokens.up}, ${tokens.upStrong})`,
display: "grid",
placeItems: "center",
color: "#fff",
fontWeight: 700,
fontSize: 14,
boxShadow: `0 4px 10px color-mix(in srgb, ${tokens.up} 40%, transparent)`,
},
logoImg: { maxHeight: 32, maxWidth: 120, objectFit: "contain" },
company: {},
hero: {
position: "relative",
borderRadius: "20px",
padding: "28px 32px",
mb: "24px",
display: "flex",
alignItems: "center",
gap: "20px",
background: tokens.surface,
border: `1px solid ${tokens.border}`,
boxShadow: cardShadow,
},
pulse: (tone) => {
const c = toneColor(tone, tokens);
return {
position: "relative",
width: 14,
height: 14,
borderRadius: "50%",
background: c,
color: c,
flexShrink: 0,
"&::before, &::after": {
content: '""',
position: "absolute",
inset: 0,
borderRadius: "50%",
background: "currentColor",
opacity: 0.5,
animation: `${pulseKeyframes} 2s ease-out infinite`,
},
"&::after": { animationDelay: "1s" },
"@media (prefers-reduced-motion: reduce)": {
"&::before, &::after": { animation: "none" },
},
};
},
statusCopy: { flex: 1, minWidth: 0 },
heroTitle: {
m: 0,
mb: "4px",
fontSize: 22,
fontWeight: 700,
letterSpacing: "-0.02em",
color: tokens.text,
},
heroSub: { m: 0, color: tokens.textMuted, fontSize: 13 },
heroIcon: (tone) => ({
color: toneColor(tone, tokens),
display: "flex",
alignItems: "center",
}),
chartSwitchWrap: { display: "flex", justifyContent: "flex-end", mb: "14px" },
chartSwitch: {
display: "inline-flex",
border: `1px solid ${tokens.border}`,
borderRadius: "999px",
background: tokens.surface,
p: "3px",
gap: "2px",
},
chartSwitchButton: (active) => ({
border: 0,
background: active ? tokens.upSoft : "transparent",
fontFamily: "inherit",
fontSize: 11,
padding: "6px 16px",
cursor: "pointer",
color: active ? tokens.up : tokens.textMuted,
fontWeight: 600,
textTransform: "uppercase",
letterSpacing: "0.08em",
transition: "background 0.2s, color 0.2s",
borderRadius: "999px",
"&:hover": { color: active ? tokens.up : tokens.text },
}),
monitorList: {
listStyle: "none",
m: 0,
p: 0,
display: "flex",
flexDirection: "column",
gap: "14px",
},
card: {
background: tokens.surface,
border: `1px solid ${tokens.border}`,
borderRadius: "16px",
boxShadow: cardShadow,
overflow: "hidden",
transition: "transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s",
opacity: 0,
transform: "translateY(8px)",
animation: `${fadeInKeyframes} 0.5s forwards`,
"&:nth-of-type(1)": { animationDelay: "0.05s" },
"&:nth-of-type(2)": { animationDelay: "0.1s" },
"&:nth-of-type(3)": { animationDelay: "0.15s" },
"&:nth-of-type(4)": { animationDelay: "0.2s" },
"&:nth-of-type(5)": { animationDelay: "0.25s" },
"&:nth-of-type(n+6)": { animationDelay: "0.3s" },
"&:hover": { transform: "translateY(-2px)", boxShadow: lightShadowHover },
"@media (prefers-reduced-motion: reduce)": {
animation: "none",
opacity: 1,
transform: "none",
},
},
cardRow: {
display: "grid",
gridTemplateColumns: "1fr auto",
alignItems: "center",
gap: "20px",
p: "18px 24px",
},
cardLeft: { minWidth: 0 },
monitorName: {
fontWeight: 600,
fontSize: 15,
letterSpacing: "-0.005em",
color: tokens.text,
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
},
monitorMeta: {
display: "flex",
gap: "10px",
alignItems: "center",
mt: "6px",
flexWrap: "wrap",
},
pill: {
fontSize: 10,
textTransform: "uppercase",
letterSpacing: "0.08em",
color: tokens.textMuted,
background: tokens.bg,
padding: "3px 9px",
borderRadius: "999px",
fontWeight: 600,
},
pillHardware: {
fontSize: 10,
textTransform: "uppercase",
letterSpacing: "0.08em",
padding: "3px 9px",
borderRadius: "999px",
fontWeight: 600,
color: isDark ? "#60a5fa" : "#2563eb",
background: isDark ? "rgba(96, 165, 250, 0.15)" : "rgba(37, 99, 235, 0.1)",
},
monitorUrl: {
fontSize: 12,
color: tokens.textMuted,
fontFamily: "ui-monospace, Menlo, monospace",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: 280,
},
badge: (tone) => ({
fontSize: 11,
fontWeight: 700,
padding: "5px 12px",
borderRadius: "999px",
display: "inline-flex",
alignItems: "center",
gap: "6px",
whiteSpace: "nowrap",
background: toneSoft(tone, tokens),
color: toneColor(tone, tokens),
"&::before": {
content: '""',
width: 6,
height: 6,
borderRadius: "50%",
background: "currentColor",
},
}),
heatmap: {
padding: "0 24px 20px",
display: "grid",
gridTemplateColumns: "repeat(25, 1fr)",
gap: "3px",
height: 46,
},
heatmapCell: (kind) => ({
borderRadius: "3px",
background: heatCellBg[kind],
opacity: kind === "empty" ? 0.4 : 1,
transition: "transform 0.15s",
"&:hover": { transform: "scaleY(1.2)" },
}),
histogram: {
padding: "0 24px",
display: "grid",
gridTemplateColumns: "repeat(25, 1fr)",
gap: "3px",
alignItems: "flex-end",
height: 46,
},
bar: (kind, heightPct) => ({
background: barBg[kind],
borderRadius: "3px",
minHeight: 4,
opacity: kind === "empty" ? 0.4 : 1,
height: `${heightPct}%`,
transition: "transform 0.15s",
"&:hover": { transform: "scaleY(1.08)" },
}),
chartStats: {
padding: "0 24px 20px",
fontSize: 11,
color: tokens.textMuted,
fontVariantNumeric: "tabular-nums",
fontWeight: 600,
},
infra: {
padding: "16px 24px 22px",
display: "grid",
gridTemplateColumns: { xs: "1fr", md: "repeat(3, 1fr)" },
gap: "14px",
},
infraEmpty: {
padding: "16px 24px 22px",
color: tokens.textMuted,
fontSize: 13,
},
gauge: {
border: `1px solid ${tokens.border}`,
borderRadius: "14px",
p: "14px 16px",
background: `linear-gradient(135deg, ${tokens.bg}, ${tokens.surface})`,
},
gaugeLabel: {
fontSize: 10,
color: tokens.textMuted,
textTransform: "uppercase",
letterSpacing: "0.1em",
fontWeight: 700,
},
gaugeValue: {
fontSize: 26,
fontWeight: 700,
letterSpacing: "-0.02em",
mt: "4px",
fontVariantNumeric: "tabular-nums",
color: tokens.text,
},
gaugeBar: {
height: 6,
background: tokens.border,
borderRadius: "3px",
overflow: "hidden",
mt: "10px",
},
gaugeFill: (level, widthPct) => ({
display: "block",
height: "100%",
background: gaugeFillBg[level],
borderRadius: "3px",
transition: "width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1)",
width: `${Math.max(0, Math.min(100, widthPct))}%`,
}),
gaugeSub: {
fontSize: 11,
color: tokens.textMuted,
mt: "8px",
fontVariantNumeric: "tabular-nums",
},
footer: {
textAlign: "center",
color: tokens.textMuted,
fontSize: 12,
mt: "48px",
"& a": {
color: tokens.up,
textDecoration: "underline",
textUnderlineOffset: "3px",
fontWeight: 700,
"&:hover": { color: tokens.upStrong },
},
},
};
};