Skip to main content

Function: getSiteStatusVariant()

function getSiteStatusVariant(
status:
| "unknown"
| "degraded"
| "down"
| "paused"
| "pending"
| "up"
| "mixed"
):
| "success"
| "error"
| "info"
| "warning";

Defined in: shared/utils/siteStatus.ts:298

Maps a SiteStatus value to a UI color variant for status indicators.

Parametersโ€‹

statusโ€‹

"unknown" | "degraded" | "down" | "paused" | "pending" | "up" | "mixed"

The SiteStatus value to map.

Returnsโ€‹

"success" | "error" | "info" | "warning"

The color variant: "success", "error", "warning", or "info".

Remarksโ€‹

The returned variant is intended for use in UI components (e.g., badges, icons). - "success": All monitors are healthy ("up").

  • "error": All monitors are down or status is unknown ("down" or "unknown"). - "warning": Degraded, mixed, or paused status ("degraded", "mixed", or "paused").
  • "info": Pending status ("pending").

Exampleโ€‹

const color = getSiteStatusVariant("up"); // "success"