From 9cce2412020feade3c005d4073325d9c5012c035 Mon Sep 17 00:00:00 2001 From: Jake Howell Date: Fri, 27 Feb 2026 22:14:37 +1100 Subject: [PATCH] fix: migrate `` out of mui (#22363) This pull-request migrates `` out of using MUI components. Using proper selects that are inline with the rest of the codebase. | Old | New | | --- | --- | | OLD_TEMPLATE_PERMISSIONS | NEW_TEMPLATE_PERMISSIONS | --- .../TemplatePermissionsPageView.tsx | 148 +++++++----------- 1 file changed, 59 insertions(+), 89 deletions(-) diff --git a/site/src/pages/TemplateSettingsPage/TemplatePermissionsPage/TemplatePermissionsPageView.tsx b/site/src/pages/TemplateSettingsPage/TemplatePermissionsPage/TemplatePermissionsPageView.tsx index 6ad89ae0db..c419034eeb 100644 --- a/site/src/pages/TemplateSettingsPage/TemplatePermissionsPage/TemplatePermissionsPageView.tsx +++ b/site/src/pages/TemplateSettingsPage/TemplatePermissionsPage/TemplatePermissionsPageView.tsx @@ -1,6 +1,3 @@ -import type { Interpolation, Theme } from "@emotion/react"; -import MenuItem from "@mui/material/MenuItem"; -import Select, { type SelectProps } from "@mui/material/Select"; import type { Group, ReducedUser, @@ -21,8 +18,14 @@ import { } from "components/DropdownMenu/DropdownMenu"; import { EmptyState } from "components/EmptyState/EmptyState"; import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "components/Select/Select"; import { Spinner } from "components/Spinner/Spinner"; -import { Stack } from "components/Stack/Stack"; import { Table, TableBody, @@ -90,7 +93,7 @@ const AddTemplateUserOrGroup: FC = ({ } }} > - +
= ({ /> - +
); }; -const RoleSelect: FC = (props) => { +interface RoleSelectProps { + value: TemplateRole; + disabled?: boolean; + onValueChange: (value: TemplateRole) => void; +} + +const RoleSelect: FC = ({ + value, + disabled, + onValueChange, +}) => { return ( ); }; @@ -216,7 +234,7 @@ export const TemplatePermissionsPageView: FC< Permissions - +
{canUpdatePermissions && ( { - onUpdateGroup( - group, - event.target.value as TemplateRole, - ); + onValueChange={(role) => { + onUpdateGroup(group, role); }} /> -
{group.role}
+
{group.role}
@@ -330,16 +345,13 @@ export const TemplatePermissionsPageView: FC< { - onUpdateUser( - user, - event.target.value as TemplateRole, - ); + onValueChange={(role) => { + onUpdateUser(user, role); }} /> -
{user.role}
+
{user.role}
@@ -374,49 +386,7 @@ export const TemplatePermissionsPageView: FC< - +
); }; - -const styles = { - select: { - // Match button small height - fontSize: 14, - width: 100, - }, - - updateSelect: { - margin: 0, - // Set a fixed width for the select. It avoids selects having different sizes - // depending on how many roles they have selected. - width: 200, - - "& .MuiSelect-root": { - // Adjusting padding because it does not have label - paddingTop: 12, - paddingBottom: 12, - - ".secondary": { - display: "none", - }, - }, - }, - - role: { - textTransform: "capitalize", - }, - - menuItem: { - lineHeight: "140%", - paddingTop: 12, - paddingBottom: 12, - whiteSpace: "normal", - inlineSize: "250px", - }, - - menuItemSecondary: (theme) => ({ - fontSize: 14, - color: theme.palette.text.secondary, - }), -} satisfies Record>;