Skip to content

Commit 4323a07

Browse files
committed
emotion: WorkspaceStatusBadge
1 parent 49c5812 commit 4323a07

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

site/src/components/WorkspaceStatusBadge/WorkspaceStatusBadge.tsx

+21-28
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import type { Workspace } from "api/typesGenerated";
22
import { Pill } from "components/Pill/Pill";
3-
import { FC, PropsWithChildren } from "react";
4-
import { makeStyles } from "@mui/styles";
5-
import { combineClasses } from "utils/combineClasses";
3+
import { type FC, type PropsWithChildren } from "react";
64
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
75
import { DormantDeletionText } from "components/WorkspaceDeletion";
86
import { getDisplayWorkspaceStatus } from "utils/workspace";
9-
import Tooltip, { TooltipProps, tooltipClasses } from "@mui/material/Tooltip";
7+
import Tooltip, {
8+
type TooltipProps,
9+
tooltipClasses,
10+
} from "@mui/material/Tooltip";
1011
import { styled } from "@mui/material/styles";
1112
import Box from "@mui/material/Box";
1213
import ErrorOutline from "@mui/icons-material/ErrorOutline";
14+
import { type Interpolation, type Theme } from "@emotion/react";
1315

1416
export type WorkspaceStatusBadgeProps = {
1517
workspace: Workspace;
@@ -56,7 +58,6 @@ export const WorkspaceStatusBadge: FC<
5658
export const WorkspaceStatusText: FC<
5759
PropsWithChildren<WorkspaceStatusBadgeProps>
5860
> = ({ workspace, className }) => {
59-
const styles = useStyles();
6061
const { text, type } = getDisplayWorkspaceStatus(
6162
workspace.latest_build.status,
6263
);
@@ -71,11 +72,8 @@ export const WorkspaceStatusText: FC<
7172
<span
7273
role="status"
7374
data-testid="build-status"
74-
className={combineClasses([
75-
className,
76-
styles.root,
77-
styles[`type-${type}`],
78-
])}
75+
className={className}
76+
css={[styles.root, styles[`type-${type}`]]}
7977
>
8078
{text}
8179
</span>
@@ -95,27 +93,22 @@ const FailureTooltip = styled(({ className, ...props }: TooltipProps) => (
9593
},
9694
}));
9795

98-
const useStyles = makeStyles((theme) => ({
96+
const styles = {
9997
root: { fontWeight: 600 },
100-
"type-error": {
98+
99+
"type-error": (theme) => ({
101100
color: theme.palette.error.light,
102-
},
103-
"type-warning": {
101+
}),
102+
"type-warning": (theme) => ({
104103
color: theme.palette.warning.light,
105-
},
106-
"type-success": {
104+
}),
105+
"type-success": (theme) => ({
107106
color: theme.palette.success.light,
108-
},
109-
"type-info": {
107+
}),
108+
"type-info": (theme) => ({
110109
color: theme.palette.info.light,
111-
},
112-
"type-undefined": {
110+
}),
111+
"type-undefined": (theme) => ({
113112
color: theme.palette.text.secondary,
114-
},
115-
"type-primary": {
116-
color: theme.palette.text.primary,
117-
},
118-
"type-secondary": {
119-
color: theme.palette.text.secondary,
120-
},
121-
}));
113+
}),
114+
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)