Style device status pills

This commit is contained in:
2025-10-16 15:46:29 -06:00
parent e67492ccdc
commit 30c9631f59

View File

@@ -777,8 +777,27 @@ export default function DeviceList({
} }
}, [COL_LABELS, defaultColumns, replaceFilters]); }, [COL_LABELS, defaultColumns, replaceFilters]);
const statusColor = useCallback( const statusTokenTheme = useMemo(
(s) => (s === "Online" ? "#00d18c" : "#ff4f4f"), () => ({
Online: {
text: "#00d18c",
background: "rgba(0, 209, 140, 0.16)",
border: "1px solid rgba(0, 209, 140, 0.45)",
dot: "#00d18c",
},
Offline: {
text: "#b0b8c8",
background: "rgba(176, 184, 200, 0.14)",
border: "1px solid rgba(176, 184, 200, 0.35)",
dot: "#c3cada",
},
default: {
text: "#e2e6f0",
background: "rgba(226, 230, 240, 0.12)",
border: "1px solid rgba(226, 230, 240, 0.25)",
dot: "#e2e6f0",
},
}),
[] []
); );
@@ -915,6 +934,7 @@ export default function DeviceList({
(params) => { (params) => {
const status = params.value || ""; const status = params.value || "";
if (!status) return null; if (!status) return null;
const theme = statusTokenTheme[status] || statusTokenTheme.default;
return ( return (
<Box <Box
component="span" component="span"
@@ -922,24 +942,36 @@ export default function DeviceList({
display: "inline-flex", display: "inline-flex",
alignItems: "center", alignItems: "center",
justifyContent: "center", justifyContent: "center",
minWidth: 70, minWidth: 76,
px: 1.5, px: 1.5,
py: 0.35, py: 0.4,
borderRadius: 999, borderRadius: 999,
bgcolor: statusColor(status), backgroundColor: theme.background,
color: "#000", border: theme.border,
color: theme.text,
fontWeight: 600, fontWeight: 600,
fontSize: "13px", fontSize: "13px",
lineHeight: 1, lineHeight: 1,
fontFamily: gridFontFamily, fontFamily: gridFontFamily,
textTransform: "capitalize", textTransform: "capitalize",
gap: 0.75,
}} }}
> >
<Box
component="span"
sx={{
width: 8,
height: 8,
borderRadius: "50%",
backgroundColor: theme.dot,
boxShadow: "0 0 0 2px rgba(0, 0, 0, 0.22)",
}}
/>
{status} {status}
</Box> </Box>
); );
}, },
[statusColor, gridFontFamily] [statusTokenTheme, gridFontFamily]
); );
const actionCellRenderer = useCallback( const actionCellRenderer = useCallback(