UptimeBar
Was it working? One mark per day or hour. What failed is ember, what was slow is amber, and what was not measured is left empty.
import { UptimeBar } from '@sypnia/ui/react'
Sixty days
60 days agoToday
Code
import { UptimeBar, type UptimeState } from '@sypnia/ui/react';
const periods = Array.from({ length: 60 }, (_, d) => {
const state: UptimeState = d === 17 ? 'down' : d === 18 || d === 41 ? 'degraded' : d < 4 ? 'none' : 'up';
return { label: `Day ${d + 1}`, state };
});
export default function NinetyDays() {
return <UptimeBar label="API availability, last 60 days" periods={periods} from="60 days ago" to="Today" />;
} Skeleton
The real piece and its skeleton: the same box, so nothing moves when the data arrives.
30 days agoToday
Code
import { UptimeBar, UptimeBarSkeleton } from '@sypnia/ui/react';
// The same periods, empty, until the checks are read.
const periods = Array.from({ length: 30 }, (_, i) => ({ label: `Day ${i + 1}`, state: (i === 17 ? 'down' : i === 9 ? 'degraded' : 'up') as 'up' | 'down' | 'degraded' }));
export default function Skeleton() {
return (
<div className="sy-stack">
<UptimeBar label="API, last 30 days" periods={periods} from="30 days ago" to="Today" />
<UptimeBarSkeleton periods={30} />
</div>
);
} When to use it
Use it when
- The history of whether a service was available, period by period.
Do not use it when
- You want to show how much or how fast: that is a LineChart.
- There is only the current state: use Status.
For everyone
- The bar announces its name and the share of measured periods that were up.
- Pair it with the list of incidents in words: colour and position alone do not explain what happened.
Props
| UptimeBar | Type | Default |
|---|---|---|
labelrequired | string | |
periodsrequired | { label: string; state: UptimeState; }[] | |
from | string | |
to | string |