ui/MachineStatus: use css modules
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
span.machine-status {
|
.machineStatus {
|
||||||
@apply flex items-center gap-1.5;
|
@apply flex items-center gap-1.5;
|
||||||
|
|
||||||
.indicator {
|
.indicator {
|
||||||
@@ -13,7 +13,7 @@ span.machine-status {
|
|||||||
background-color: theme(colors.fg.semantic.error.1);
|
background-color: theme(colors.fg.semantic.error.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.out-of-sync > .indicator {
|
&.outOfSync > .indicator {
|
||||||
background-color: theme(colors.fg.inv.3);
|
background-color: theme(colors.fg.inv.3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import "./MachineStatus.css";
|
import styles from "./MachineStatus.module.css";
|
||||||
|
|
||||||
import { Badge } from "@kobalte/core/badge";
|
import { Badge } from "@kobalte/core/badge";
|
||||||
import cx from "classnames";
|
import cx from "classnames";
|
||||||
import { Match, Show, Switch } from "solid-js";
|
import { Match, Show, Switch } from "solid-js";
|
||||||
@@ -14,8 +13,7 @@ export interface MachineStatusProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const MachineStatus = (props: MachineStatusProps) => {
|
export const MachineStatus = (props: MachineStatusProps) => {
|
||||||
const status = () => props.status;
|
// FIXME: this will break i18n in the future
|
||||||
|
|
||||||
// remove the '_' from the enum
|
// remove the '_' from the enum
|
||||||
// we will use css transform in the typography component to capitalize
|
// we will use css transform in the typography component to capitalize
|
||||||
const statusText = () => props.status?.replaceAll("_", " ");
|
const statusText = () => props.status?.replaceAll("_", " ");
|
||||||
@@ -25,15 +23,17 @@ export const MachineStatus = (props: MachineStatusProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
<Match when={!status()}>
|
<Match when={!props.status}>
|
||||||
<Loader />
|
<Loader />
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={status()}>
|
<Match when={props.status}>
|
||||||
<Badge
|
<Badge
|
||||||
class={cx("machine-status", {
|
class={cx(styles.machineStatus, {
|
||||||
"not-installed": status() == "not_installed",
|
[styles.online]: props.status == "online",
|
||||||
|
[styles.offline]: props.status == "offline",
|
||||||
|
[styles.outOfSync]: props.status == "out_of_sync",
|
||||||
})}
|
})}
|
||||||
textValue={status()}
|
textValue={props.status}
|
||||||
>
|
>
|
||||||
{props.label && (
|
{props.label && (
|
||||||
<Typography
|
<Typography
|
||||||
@@ -47,10 +47,10 @@ export const MachineStatus = (props: MachineStatusProps) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Show
|
<Show
|
||||||
when={status() != "not_installed"}
|
when={props.status != "not_installed"}
|
||||||
fallback={<Icon icon="Offline" inverted={true} />}
|
fallback={<Icon icon="Offline" inverted={true} />}
|
||||||
>
|
>
|
||||||
<div class="indicator" />
|
<div class={styles.indicator} />
|
||||||
</Show>
|
</Show>
|
||||||
</Badge>
|
</Badge>
|
||||||
</Match>
|
</Match>
|
||||||
|
|||||||
Reference in New Issue
Block a user