Skip to content

Commit 1a01127

Browse files
committed
refactor: clean up WorkspacesButton to use more native MUI
1 parent 55ab10a commit 1a01127

File tree

2 files changed

+125
-125
lines changed

2 files changed

+125
-125
lines changed

coderd/database/queries.sql.go

Lines changed: 113 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/pages/WorkspacesPage/WorkspacesButton.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Button from "@mui/material/Button";
1111
import Link from "@mui/material/Link";
1212
import AddIcon from "@mui/icons-material/AddOutlined";
1313
import OpenIcon from "@mui/icons-material/OpenInNewOutlined";
14+
import Typography from "@mui/material/Typography";
1415

1516
import { Loader } from "components/Loader/Loader";
1617
import { OverflowY } from "components/OverflowY/OverflowY";
@@ -21,6 +22,7 @@ import {
2122
PopoverContainer,
2223
PopoverLink,
2324
} from "components/PopoverContainer/PopoverContainer";
25+
import { useTheme } from "@emotion/react";
2426

2527
const ICON_SIZE = 18;
2628
const COLUMN_GAP = 1.5;
@@ -42,6 +44,8 @@ function sortTemplatesByUsersDesc(
4244
}
4345

4446
function WorkspaceResultsRow({ template }: { template: Template }) {
47+
const theme = useTheme();
48+
4549
return (
4650
<PopoverLink to={`/templates/${template.name}/workspace`}>
4751
<Box
@@ -76,25 +80,20 @@ function WorkspaceResultsRow({ template }: { template: Template }) {
7680
color: "white",
7781
}}
7882
>
79-
<Box
83+
<Typography
8084
component="p"
81-
sx={{
82-
marginY: 0,
83-
paddingBottom: 0.5,
84-
overflow: "hidden",
85-
textOverflow: "ellipsis",
86-
whiteSpace: "nowrap",
87-
}}
85+
sx={{ marginY: 0, paddingBottom: 0.5, lineHeight: 1 }}
86+
noWrap
8887
>
8988
{template.display_name || "[Unnamed]"}
90-
</Box>
89+
</Typography>
9190

9291
<Box
9392
component="p"
9493
sx={{
9594
marginY: 0,
9695
fontSize: 14,
97-
color: (theme) => theme.palette.text.secondary,
96+
color: theme.palette.text.secondary,
9897
}}
9998
>
10099
{/*
@@ -118,6 +117,7 @@ export function WorkspacesButton() {
118117
const organizationId = useOrganizationId();
119118
const permissions = usePermissions();
120119
const templatesQuery = useQuery(templates(organizationId));
120+
const theme = useTheme();
121121

122122
// Dataset should always be small enough that client-side filtering should be
123123
// good enough. Can swap out down the line if it becomes an issue
@@ -192,7 +192,7 @@ export function WorkspacesButton() {
192192
sx={{
193193
outline: "none",
194194
"&:focus": {
195-
backgroundColor: (theme) => theme.palette.action.focus,
195+
backgroundColor: theme.palette.action.focus,
196196
},
197197
}}
198198
>
@@ -203,7 +203,7 @@ export function WorkspacesButton() {
203203
flexFlow: "row nowrap",
204204
alignItems: "center",
205205
columnGap: COLUMN_GAP,
206-
borderTop: (theme) => `1px solid ${theme.palette.divider}`,
206+
borderTop: `1px solid ${theme.palette.divider}`,
207207
}}
208208
>
209209
<Box component="span" sx={{ width: `${ICON_SIZE}px` }}>

0 commit comments

Comments
 (0)