diff --git a/src/components/MetricWidget.tsx b/src/components/MetricWidget.tsx index 1718bd9..c8e3f49 100644 --- a/src/components/MetricWidget.tsx +++ b/src/components/MetricWidget.tsx @@ -6,12 +6,17 @@ type MetricWidgetProps = { }; export function MetricWidget({ item }: MetricWidgetProps) { - const title = item.name?.trim() || item.tag; + const name = item.name?.trim() || item.tag; + const unit = item.unitOfMeasurement?.trim(); return ( -
- {title} - {formatNumber(item.value)} +
+ {item.tag} + {name} + + {formatNumber(item.value)} + {unit ? {unit} : null} +
); } diff --git a/src/styles/components/metrics.css b/src/styles/components/metrics.css index 1cd3504..8d91f76 100644 --- a/src/styles/components/metrics.css +++ b/src/styles/components/metrics.css @@ -15,7 +15,7 @@ height: 100%; display: flex; flex-direction: column; - gap: 10px; + gap: 5px; padding: 12px; border: 1px solid rgba(88, 103, 121, 0.42); border-radius: 8px; @@ -27,28 +27,74 @@ 0 6px 14px rgba(0, 0, 0, 0.28); } -.metric-widget__tag { - flex: 0 0 auto; +.metric-widget__id, +.metric-widget__name, +.metric-widget__reading, +.metric-widget__value { min-width: 0; - color: #cbd5e1; - font-size: 0.74rem; - font-weight: 600; +} + +.metric-widget__id, +.metric-widget__name { + display: block; + overflow: hidden; + text-overflow: ellipsis; +} + +.metric-widget__id { + flex: 0 0 auto; + color: #64748b; + font-size: 0.62rem; + font-weight: 650; + letter-spacing: 0.02em; + line-height: 1.2; + white-space: nowrap; +} + +.metric-widget__name { + flex: 0 0 auto; + color: #e5e7eb; + font-size: 0.82rem; + font-weight: 760; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; word-break: break-word; } -.metric-widget__value { +.metric-widget__reading { margin-top: auto; align-self: flex-end; - min-width: 0; + display: inline-flex; + align-items: baseline; + justify-content: flex-end; + gap: 5px; + max-width: 100%; + text-align: right; +} + +.metric-widget__value { color: #f8fafc; - font-size: 1.1rem; - font-weight: 700; + font-size: 1.22rem; + font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; + overflow: hidden; text-align: right; + text-overflow: ellipsis; + white-space: nowrap; +} + +.metric-widget__unit { + flex: 0 1 auto; + min-width: 0; + color: #94a3b8; + font-size: 0.72rem; + font-weight: 650; + line-height: 1.2; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .metric-mosaic {