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:
1 parent
b95d8886b9
commit
c6c50063d8
12 files changed
+1442
-1616
No files matched your search
@@ -13,7 +13,8 @@ import {
|
||||
resolveOverallStatus,
|
||||
statusBadgeKey,
|
||||
} from "../shared/overallStatus";
|
||||
import "./editorial.css";
|
||||
import { useStatusPageTheme } from "../StatusPageThemeProvider";
|
||||
import { editorialStyles } from "./styles";
|
||||
|
||||
type StatusPageMonitor = Monitor & { checks?: Monitor["recentChecks"] };
|
||||
|
||||
@@ -22,14 +23,12 @@ interface Props {
|
||||
monitors: StatusPageMonitor[];
|
||||
}
|
||||
|
||||
const PREFIX = "ed";
|
||||
|
||||
export const EditorialStatusPage = ({ statusPage, monitors }: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const { tokens, mode } = useStatusPageTheme();
|
||||
const styles = useMemo(() => editorialStyles(tokens, mode === "dark"), [tokens, mode]);
|
||||
const [chartMode, setChartMode] = useState<"heatmap" | "histogram">("heatmap");
|
||||
|
||||
// Stable date across re-renders; the page polls every 10s and we don't
|
||||
// want the dateline to jitter.
|
||||
const todayLabel = useMemo(
|
||||
() =>
|
||||
new Date().toLocaleDateString(undefined, {
|
||||
@@ -48,69 +47,88 @@ export const EditorialStatusPage = ({ 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-wrap`}>
|
||||
<Box sx={styles.brandWrap}>
|
||||
{logoSrc && (
|
||||
<Box
|
||||
component="img"
|
||||
src={logoSrc}
|
||||
alt={statusPage.companyName}
|
||||
className={`${PREFIX}-logo-img`}
|
||||
sx={styles.logoImg}
|
||||
/>
|
||||
)}
|
||||
<h2 className={`${PREFIX}-brand-eyebrow`}>{statusPage.companyName}</h2>
|
||||
<h1 className={`${PREFIX}-brand-title`}>
|
||||
<Box
|
||||
component="h2"
|
||||
sx={styles.brandEyebrow}
|
||||
>
|
||||
{statusPage.companyName}
|
||||
</Box>
|
||||
<Box
|
||||
component="h1"
|
||||
sx={styles.brandTitle}
|
||||
>
|
||||
{t("pages.statusPages.editorial.reportTitle")}
|
||||
</h1>
|
||||
</Box>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<p className={`${PREFIX}-status-line ${PREFIX}-tone-${overall.tone}`}>
|
||||
<span className={`${PREFIX}-status-dot`} />
|
||||
<Box
|
||||
component="p"
|
||||
sx={styles.statusLine}
|
||||
>
|
||||
<Box
|
||||
component="span"
|
||||
sx={styles.statusDot(overall.tone)}
|
||||
/>
|
||||
{overall.message}
|
||||
</p>
|
||||
<p className={`${PREFIX}-dateline`}>
|
||||
</Box>
|
||||
<Box
|
||||
component="p"
|
||||
sx={styles.dateline}
|
||||
>
|
||||
{todayLabel} ·{" "}
|
||||
{t("pages.statusPages.statusBar.monitoringSummary", {
|
||||
count: monitors.length,
|
||||
})}
|
||||
</p>
|
||||
</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", true)}
|
||||
>
|
||||
{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", false)}
|
||||
>
|
||||
{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";
|
||||
@@ -122,48 +140,65 @@ export const EditorialStatusPage = ({ 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>
|
||||
@@ -173,7 +208,7 @@ export const EditorialStatusPage = ({ statusPage, monitors }: Props) => {
|
||||
|
||||
<Box
|
||||
component="footer"
|
||||
className={`${PREFIX}-footer`}
|
||||
sx={styles.footer}
|
||||
>
|
||||
{t("pages.statusPages.footer.poweredBy")}{" "}
|
||||
<a
|
||||
|
||||
@@ -1,353 +0,0 @@
|
||||
/*
|
||||
* Editorial theme — scoped to [data-status-theme="editorial"].
|
||||
* Port of /Users/gorkemcetin/Desktop/checkmate-status-mockups/04-editorial.html.
|
||||
* Signature traits: serif body, narrow 760px column, newspaper-style
|
||||
* header with eyebrow + big "Service Report" title, flat rectangular
|
||||
* badges (no border-radius), hairline dividers instead of cards,
|
||||
* dateline below status, serif gauge values.
|
||||
*/
|
||||
|
||||
[data-status-theme="editorial"]:not([data-status-transparent]) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background: var(--sp-bg);
|
||||
}
|
||||
|
||||
[data-status-theme="editorial"] .ed-page {
|
||||
flex: 1 0 auto;
|
||||
max-width: 760px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 64px 24px 96px;
|
||||
font:
|
||||
15px/1.6 Georgia,
|
||||
"Iowan Old Style",
|
||||
"Palatino Linotype",
|
||||
serif;
|
||||
color: var(--sp-text);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* --- header: eyebrow caps + serif h1, 2px underline under whole block --- */
|
||||
[data-status-theme="editorial"] .ed-top {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 48px;
|
||||
border-bottom: 2px solid var(--sp-text);
|
||||
padding-bottom: 18px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-brand-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-logo-img {
|
||||
max-height: 48px;
|
||||
max-width: 160px;
|
||||
object-fit: contain;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-brand-eyebrow {
|
||||
margin: 0;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3em;
|
||||
font-weight: 700;
|
||||
color: var(--sp-text-muted);
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-brand-title {
|
||||
margin: 6px 0 0;
|
||||
font-size: 40px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 1;
|
||||
color: var(--sp-text);
|
||||
}
|
||||
|
||||
/* --- status line: single sentence, not a card --- */
|
||||
[data-status-theme="editorial"] .ed-status-line {
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
margin: 0 0 8px;
|
||||
letter-spacing: -0.01em;
|
||||
line-height: 1.35;
|
||||
color: var(--sp-text);
|
||||
font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-status-dot {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background: var(--sp-up);
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-status-line.ed-tone-warn .ed-status-dot {
|
||||
background: var(--sp-warn);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-status-line.ed-tone-down .ed-status-dot {
|
||||
background: var(--sp-down);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-dateline {
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
color: var(--sp-text-muted);
|
||||
margin: 0 0 56px;
|
||||
}
|
||||
|
||||
/* --- chart switch: rectangular, dark fill on active (no radius) --- */
|
||||
[data-status-theme="editorial"] .ed-chart-switch-wrap {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 20px;
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-chart-switch {
|
||||
display: inline-flex;
|
||||
border: 1px solid var(--sp-text);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-chart-switch > button {
|
||||
font: inherit;
|
||||
font-size: 10px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.2em;
|
||||
padding: 6px 14px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sp-text);
|
||||
cursor: pointer;
|
||||
font-weight: 700;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-chart-switch > button + button {
|
||||
border-left: 1px solid var(--sp-text);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-chart-switch > button.ed-active {
|
||||
background: var(--sp-text);
|
||||
color: var(--sp-bg);
|
||||
}
|
||||
|
||||
/* --- monitor cards: transparent rows with bottom hairline --- */
|
||||
[data-status-theme="editorial"] .ed-monitor-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-card {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-bottom: 1px solid var(--sp-border);
|
||||
margin-bottom: 0;
|
||||
padding: 20px 0;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-card:last-of-type {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
[data-status-theme="editorial"] .ed-card-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto;
|
||||
align-items: baseline;
|
||||
gap: 20px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-card-left {
|
||||
min-width: 0;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-monitor-name {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.015em;
|
||||
color: var(--sp-text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-monitor-meta {
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
color: var(--sp-text-muted);
|
||||
margin-top: 6px;
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-pill {
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.12em;
|
||||
font-weight: 700;
|
||||
color: var(--sp-text-muted);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-pill-hardware {
|
||||
color: var(--sp-up);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-monitor-url {
|
||||
font-family: ui-monospace, Menlo, monospace;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 280px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* --- badge: rectangular flat label --- */
|
||||
[data-status-theme="editorial"] .ed-badge {
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
padding: 4px 10px;
|
||||
border-radius: 0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.15em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-badge-up {
|
||||
background: var(--sp-up-soft);
|
||||
color: var(--sp-up);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-badge-warn {
|
||||
background: var(--sp-warn-soft);
|
||||
color: var(--sp-warn);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-badge-down {
|
||||
background: var(--sp-down-soft);
|
||||
color: var(--sp-down);
|
||||
}
|
||||
|
||||
/* --- charts: flat rectangles, no glow --- */
|
||||
[data-status-theme="editorial"] .ed-heatmap {
|
||||
margin-top: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(25, 1fr);
|
||||
gap: 2px;
|
||||
height: 40px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell {
|
||||
background: var(--sp-up);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell.ed-fast {
|
||||
background: var(--sp-up);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell.ed-med {
|
||||
background: color-mix(in srgb, var(--sp-up) 60%, var(--sp-bg));
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell.ed-slow {
|
||||
background: var(--sp-warn);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell.ed-down {
|
||||
background: var(--sp-down);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-heatmap-cell.ed-empty {
|
||||
background: var(--sp-border);
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
[data-status-theme="editorial"] .ed-histogram {
|
||||
margin-top: 16px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(25, 1fr);
|
||||
gap: 2px;
|
||||
align-items: flex-end;
|
||||
height: 40px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-bar {
|
||||
background: var(--sp-up);
|
||||
min-height: 3px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-bar.ed-down {
|
||||
background: var(--sp-down);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-bar.ed-empty {
|
||||
background: var(--sp-border);
|
||||
opacity: 0.5;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-chart-stats {
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 11px;
|
||||
color: var(--sp-text-muted);
|
||||
font-variant-numeric: tabular-nums;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
}
|
||||
|
||||
/* --- gauges: 3-column with serif value + 2px underline bar --- */
|
||||
[data-status-theme="editorial"] .ed-infra {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 24px;
|
||||
margin-top: 20px;
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
[data-status-theme="editorial"] .ed-infra {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-infra-empty {
|
||||
margin-top: 20px;
|
||||
color: var(--sp-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-label {
|
||||
font-size: 10px;
|
||||
color: var(--sp-text-muted);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.18em;
|
||||
font-weight: 700;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-value {
|
||||
font-size: 28px;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
margin-top: 4px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-family: Georgia, serif;
|
||||
color: var(--sp-text);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-bar {
|
||||
height: 2px;
|
||||
background: var(--sp-border);
|
||||
margin-top: 10px;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-fill {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background: var(--sp-up);
|
||||
transition: width 0.8s;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-fill.ed-warm {
|
||||
background: var(--sp-warn);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-fill.ed-hot {
|
||||
background: var(--sp-down);
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-gauge-sub {
|
||||
font-size: 11px;
|
||||
color: var(--sp-text-muted);
|
||||
margin-top: 8px;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
/* --- footer: tiny uppercase tracked + underlined link --- */
|
||||
[data-status-theme="editorial"] .ed-footer {
|
||||
text-align: center;
|
||||
color: var(--sp-text-muted);
|
||||
font-size: 11px;
|
||||
margin-top: 56px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.2em;
|
||||
font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
[data-status-theme="editorial"] .ed-footer a {
|
||||
color: var(--sp-text);
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid var(--sp-text);
|
||||
padding-bottom: 2px;
|
||||
font-weight: 700;
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
import type { SxProps, Theme } from "@mui/material/styles";
|
||||
import type { StatusPageThemeTokens } from "../tokens";
|
||||
import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus";
|
||||
|
||||
export type EditorialHeatCell = "fast" | "med" | "slow" | "down" | "empty";
|
||||
export type EditorialBarKind = "up" | "down" | "empty";
|
||||
export type EditorialGaugeFill = "ok" | "warm" | "hot";
|
||||
|
||||
export interface EditorialStyles {
|
||||
page: SxProps<Theme>;
|
||||
top: SxProps<Theme>;
|
||||
brandWrap: SxProps<Theme>;
|
||||
logoImg: SxProps<Theme>;
|
||||
brandEyebrow: SxProps<Theme>;
|
||||
brandTitle: SxProps<Theme>;
|
||||
statusLine: SxProps<Theme>;
|
||||
statusDot: (tone: OverallTone) => SxProps<Theme>;
|
||||
dateline: SxProps<Theme>;
|
||||
chartSwitchWrap: SxProps<Theme>;
|
||||
chartSwitch: SxProps<Theme>;
|
||||
chartSwitchButton: (active: boolean, isFirst: 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: EditorialHeatCell) => SxProps<Theme>;
|
||||
histogram: SxProps<Theme>;
|
||||
bar: (kind: EditorialBarKind, 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: EditorialGaugeFill, widthPct: number) => SxProps<Theme>;
|
||||
gaugeSub: SxProps<Theme>;
|
||||
footer: SxProps<Theme>;
|
||||
}
|
||||
|
||||
const serifStack = 'Georgia, "Iowan Old Style", "Palatino Linotype", serif';
|
||||
const sansStack = '-apple-system, "Helvetica Neue", Arial, sans-serif';
|
||||
|
||||
export const editorialStyles = (
|
||||
tokens: StatusPageThemeTokens,
|
||||
_isDark: boolean
|
||||
): EditorialStyles => {
|
||||
const heatCellBg: Record<EditorialHeatCell, string> = {
|
||||
fast: tokens.up,
|
||||
med: `color-mix(in srgb, ${tokens.up} 60%, ${tokens.bg})`,
|
||||
slow: tokens.warn,
|
||||
down: tokens.down,
|
||||
empty: tokens.border,
|
||||
};
|
||||
|
||||
const barBg: Record<EditorialBarKind, string> = {
|
||||
up: tokens.up,
|
||||
down: tokens.down,
|
||||
empty: tokens.border,
|
||||
};
|
||||
|
||||
const gaugeFillBg: Record<EditorialGaugeFill, string> = {
|
||||
ok: tokens.up,
|
||||
warm: tokens.warn,
|
||||
hot: tokens.down,
|
||||
};
|
||||
|
||||
return {
|
||||
page: {
|
||||
flex: "1 0 auto",
|
||||
maxWidth: 760,
|
||||
width: "100%",
|
||||
mx: "auto",
|
||||
p: "64px 24px 96px",
|
||||
fontFamily: serifStack,
|
||||
fontSize: 15,
|
||||
lineHeight: 1.6,
|
||||
color: tokens.text,
|
||||
WebkitFontSmoothing: "antialiased",
|
||||
},
|
||||
|
||||
top: {
|
||||
display: "flex",
|
||||
alignItems: "flex-end",
|
||||
justifyContent: "space-between",
|
||||
mb: "48px",
|
||||
borderBottom: `2px solid ${tokens.text}`,
|
||||
pb: "18px",
|
||||
},
|
||||
brandWrap: { display: "flex", flexDirection: "column" },
|
||||
logoImg: { maxHeight: 48, maxWidth: 160, objectFit: "contain", mb: "8px" },
|
||||
brandEyebrow: {
|
||||
m: 0,
|
||||
fontSize: 11,
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.3em",
|
||||
fontWeight: 700,
|
||||
color: tokens.textMuted,
|
||||
fontFamily: sansStack,
|
||||
},
|
||||
brandTitle: {
|
||||
mt: "6px",
|
||||
mb: 0,
|
||||
fontSize: 40,
|
||||
fontWeight: 700,
|
||||
letterSpacing: "-0.02em",
|
||||
lineHeight: 1,
|
||||
color: tokens.text,
|
||||
},
|
||||
|
||||
statusLine: {
|
||||
fontSize: 22,
|
||||
fontWeight: 400,
|
||||
m: 0,
|
||||
mb: "8px",
|
||||
letterSpacing: "-0.01em",
|
||||
lineHeight: 1.35,
|
||||
color: tokens.text,
|
||||
fontFamily: serifStack,
|
||||
},
|
||||
statusDot: (tone) => ({
|
||||
display: "inline-block",
|
||||
width: 10,
|
||||
height: 10,
|
||||
borderRadius: "50%",
|
||||
background: toneColor(tone, tokens),
|
||||
mr: "10px",
|
||||
verticalAlign: "middle",
|
||||
}),
|
||||
dateline: {
|
||||
fontFamily: sansStack,
|
||||
fontSize: 11,
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.12em",
|
||||
color: tokens.textMuted,
|
||||
m: 0,
|
||||
mb: "56px",
|
||||
},
|
||||
|
||||
chartSwitchWrap: {
|
||||
display: "flex",
|
||||
justifyContent: "flex-end",
|
||||
mb: "20px",
|
||||
fontFamily: sansStack,
|
||||
},
|
||||
chartSwitch: { display: "inline-flex", border: `1px solid ${tokens.text}` },
|
||||
chartSwitchButton: (active, isFirst) => ({
|
||||
fontFamily: "inherit",
|
||||
fontSize: 10,
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.2em",
|
||||
padding: "6px 14px",
|
||||
border: 0,
|
||||
background: active ? tokens.text : "transparent",
|
||||
color: active ? tokens.bg : tokens.text,
|
||||
cursor: "pointer",
|
||||
fontWeight: 700,
|
||||
...(isFirst ? {} : { borderLeft: `1px solid ${tokens.text}` }),
|
||||
}),
|
||||
|
||||
monitorList: {
|
||||
listStyle: "none",
|
||||
m: 0,
|
||||
p: 0,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
},
|
||||
card: {
|
||||
background: "transparent",
|
||||
border: 0,
|
||||
borderBottom: `1px solid ${tokens.border}`,
|
||||
mb: 0,
|
||||
py: "20px",
|
||||
"&:last-of-type": { borderBottom: 0 },
|
||||
},
|
||||
cardRow: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "1fr auto",
|
||||
alignItems: "baseline",
|
||||
gap: "20px",
|
||||
},
|
||||
cardLeft: { minWidth: 0 },
|
||||
monitorName: {
|
||||
fontSize: 20,
|
||||
fontWeight: 700,
|
||||
letterSpacing: "-0.015em",
|
||||
color: tokens.text,
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
},
|
||||
monitorMeta: {
|
||||
fontFamily: sansStack,
|
||||
fontSize: 12,
|
||||
color: tokens.textMuted,
|
||||
mt: "6px",
|
||||
display: "flex",
|
||||
gap: "12px",
|
||||
flexWrap: "wrap",
|
||||
alignItems: "center",
|
||||
},
|
||||
pill: {
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.12em",
|
||||
fontWeight: 700,
|
||||
color: tokens.textMuted,
|
||||
},
|
||||
pillHardware: {
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.12em",
|
||||
fontWeight: 700,
|
||||
color: tokens.up,
|
||||
},
|
||||
monitorUrl: {
|
||||
fontFamily: "ui-monospace, Menlo, monospace",
|
||||
overflow: "hidden",
|
||||
textOverflow: "ellipsis",
|
||||
whiteSpace: "nowrap",
|
||||
maxWidth: 280,
|
||||
fontSize: 12,
|
||||
},
|
||||
|
||||
badge: (tone) => ({
|
||||
fontFamily: sansStack,
|
||||
fontSize: 10,
|
||||
fontWeight: 700,
|
||||
padding: "4px 10px",
|
||||
borderRadius: 0,
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.15em",
|
||||
whiteSpace: "nowrap",
|
||||
background: toneSoft(tone, tokens),
|
||||
color: toneColor(tone, tokens),
|
||||
}),
|
||||
|
||||
heatmap: {
|
||||
mt: "16px",
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(25, 1fr)",
|
||||
gap: "2px",
|
||||
height: 40,
|
||||
},
|
||||
heatmapCell: (kind) => ({
|
||||
background: heatCellBg[kind],
|
||||
opacity: kind === "empty" ? 0.5 : 1,
|
||||
}),
|
||||
|
||||
histogram: {
|
||||
mt: "16px",
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(25, 1fr)",
|
||||
gap: "2px",
|
||||
alignItems: "flex-end",
|
||||
height: 40,
|
||||
},
|
||||
bar: (kind, heightPct) => ({
|
||||
background: barBg[kind],
|
||||
minHeight: 3,
|
||||
opacity: kind === "empty" ? 0.5 : 1,
|
||||
height: `${heightPct}%`,
|
||||
}),
|
||||
chartStats: {
|
||||
fontFamily: sansStack,
|
||||
fontSize: 11,
|
||||
color: tokens.textMuted,
|
||||
fontVariantNumeric: "tabular-nums",
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.1em",
|
||||
},
|
||||
|
||||
infra: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: { xs: "1fr", md: "repeat(3, 1fr)" },
|
||||
gap: "24px",
|
||||
mt: "20px",
|
||||
fontFamily: sansStack,
|
||||
},
|
||||
infraEmpty: { mt: "20px", color: tokens.textMuted, fontSize: 13 },
|
||||
gauge: {},
|
||||
gaugeLabel: {
|
||||
fontSize: 10,
|
||||
color: tokens.textMuted,
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.18em",
|
||||
fontWeight: 700,
|
||||
},
|
||||
gaugeValue: {
|
||||
fontSize: 28,
|
||||
fontWeight: 700,
|
||||
letterSpacing: "-0.02em",
|
||||
mt: "4px",
|
||||
fontVariantNumeric: "tabular-nums",
|
||||
fontFamily: serifStack,
|
||||
color: tokens.text,
|
||||
},
|
||||
gaugeBar: { height: 2, background: tokens.border, mt: "10px" },
|
||||
gaugeFill: (level, widthPct) => ({
|
||||
display: "block",
|
||||
height: "100%",
|
||||
background: gaugeFillBg[level],
|
||||
transition: "width 0.8s",
|
||||
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: 11,
|
||||
mt: "56px",
|
||||
textTransform: "uppercase",
|
||||
letterSpacing: "0.2em",
|
||||
fontFamily: sansStack,
|
||||
"& a": {
|
||||
color: tokens.text,
|
||||
textDecoration: "none",
|
||||
borderBottom: `1px solid ${tokens.text}`,
|
||||
pb: "2px",
|
||||
fontWeight: 700,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user