From 9935da86c624bbf46e4b47789052e7b5e988c799 Mon Sep 17 00:00:00 2001 From: Jaayden Halko Date: Wed, 8 Oct 2025 21:13:04 +0100 Subject: [PATCH] chore: migrate appearanceform to Tailwind and shadcn (#20204) --- site/src/index.css | 3 +- .../AppearancePage/AppearanceForm.tsx | 265 ++++++------------ 2 files changed, 89 insertions(+), 179 deletions(-) diff --git a/site/src/index.css b/site/src/index.css index 6486e16256..40adcb9fba 100644 --- a/site/src/index.css +++ b/site/src/index.css @@ -8,7 +8,8 @@ @tailwind utilities; @layer base { - :root { + :root, + .light { --content-primary: 240 10% 4%; --content-secondary: 240 5% 34%; --content-link: 221 83% 53%; diff --git a/site/src/pages/UserSettingsPage/AppearancePage/AppearanceForm.tsx b/site/src/pages/UserSettingsPage/AppearancePage/AppearanceForm.tsx index aa10f315b6..0b86d8fdf7 100644 --- a/site/src/pages/UserSettingsPage/AppearancePage/AppearanceForm.tsx +++ b/site/src/pages/UserSettingsPage/AppearancePage/AppearanceForm.tsx @@ -1,10 +1,3 @@ -import type { Interpolation } from "@emotion/react"; -import CircularProgress from "@mui/material/CircularProgress"; -import FormControl from "@mui/material/FormControl"; -import FormControlLabel from "@mui/material/FormControlLabel"; -import Radio from "@mui/material/Radio"; -import RadioGroup from "@mui/material/RadioGroup"; -import { visuallyHidden } from "@mui/utils"; import { type TerminalFontName, TerminalFontNames, @@ -12,10 +5,11 @@ import { } from "api/typesGenerated"; import { ErrorAlert } from "components/Alert/ErrorAlert"; import { PreviewBadge } from "components/Badges/Badges"; -import { Stack } from "components/Stack/Stack"; -import { ThemeOverride } from "contexts/ThemeProvider"; +import { Label } from "components/Label/Label"; +import { RadioGroup, RadioGroupItem } from "components/RadioGroup/RadioGroup"; +import { Spinner } from "components/Spinner/Spinner"; import type { FC } from "react"; -import themes, { DEFAULT_THEME, type Theme } from "theme"; +import { DEFAULT_THEME } from "theme"; import { DEFAULT_TERMINAL_FONT, terminalFontLabels, @@ -67,67 +61,65 @@ export const AppearanceForm: FC = ({
+
Theme - {isUpdating && } - + +
} layout="fluid" + className="mb-12" > - +
onChangeTheme("auto")} /> onChangeTheme("dark")} /> onChangeTheme("light")} /> - +
-
- Terminal Font - {isUpdating && } - +
+ Terminal Font + +
} layout="fluid" > - - - onChangeTerminalFont(toTerminalFontName(value)) - } - > - {TerminalFontNames.filter((name) => name !== "").map((name) => ( - } - label={ -
- {terminalFontLabels[name]} -
- } - /> - ))} -
-
+ + onChangeTerminalFont(toTerminalFontName(value)) + } + > + {TerminalFontNames.filter((name) => name !== "").map((name) => ( +
+ + +
+ ))} +
); @@ -139,8 +131,10 @@ function toTerminalFontName(value: string): TerminalFontName { : ""; } +type ThemeMode = "dark" | "light"; + interface AutoThemePreviewButtonProps extends Omit { - themes: [Theme, Theme]; + themes: [ThemeMode, ThemeMode]; onSelect?: () => void; } @@ -163,13 +157,15 @@ const AutoThemePreviewButton: FC = ({ value={displayName} checked={active} onChange={onSelect} - css={{ ...visuallyHidden }} + className="sr-only" /> -