"use client"; import { Card, Flex, Text, Tooltip, VisuallyHidden } from "@mantine/core"; import { useElementSize } from "@mantine/hooks"; import { useRequiredBoard } from "@homarr/boards/context"; import type { TablerIcon } from "@homarr/ui"; export interface SpeedStatCardProps { icon: TablerIcon; color: "blue" | "teal" | "orange" | "green" | "red"; value: string; label: string; compact?: boolean; } export function SpeedStatCard({ icon: Icon, color, value, label, compact = false }: SpeedStatCardProps) { const { ref, height, width } = useElementSize(); const board = useRequiredBoard(); const isWide = width > height + 20; const hideLabel = height > 0 && height <= 38; const surfaceColor = `var(--mantine-color-${color}-filled)`; const accentColor = `var(--mantine-color-${color}-5)`; const surfaceAlpha = compact ? 0.1 : 0.14; const surfaceBackground = `rgb(from ${surfaceColor} r g b / calc(var(--opacity, 1) * ${surfaceAlpha}))`; const surfaceBorder = "rgb(from var(--mantine-color-default-border) r g b / calc(var(--opacity, 1) * 0.45))"; return ( {value} {!hideLabel && ( {label} )} {hideLabel && {label}} ); }