diff --git a/site/src/components/Stats/Stats.tsx b/site/src/components/Stats/Stats.tsx index c2674e9c7f18e..8fa17d7385a83 100644 --- a/site/src/components/Stats/Stats.tsx +++ b/site/src/components/Stats/Stats.tsx @@ -1,40 +1,28 @@ -import Box from "@mui/material/Box" -import { makeStyles } from "@mui/styles" -import { ComponentProps, FC, PropsWithChildren } from "react" -import { combineClasses } from "utils/combineClasses" +import { type CSSObject, type Interpolation, type Theme } from "@emotion/react"; +import Box from "@mui/material/Box"; +import { type ComponentProps, type FC } from "react"; export const Stats: FC> = (props) => { - const styles = useStyles() - return ( - - ) -} + return ; +}; export const StatsItem: FC< { - label: string - value: string | number | JSX.Element + label: string; + value: string | number | JSX.Element; } & ComponentProps > = ({ label, value, ...divProps }) => { - const styles = useStyles() - return ( - - {label}: - {value} + + {label}: + {value} - ) -} + ); +}; -const useStyles = makeStyles((theme) => ({ - stats: { - ...theme.typography.body2, +const styles = { + stats: (theme) => ({ + ...(theme.typography.body2 as CSSObject), paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), borderRadius: theme.shape.borderRadius, @@ -49,9 +37,9 @@ const useStyles = makeStyles((theme) => ({ display: "block", padding: theme.spacing(2), }, - }, + }), - statItem: { + statItem: (theme) => ({ padding: theme.spacing(1.75), paddingLeft: theme.spacing(2), paddingRight: theme.spacing(2), @@ -62,14 +50,14 @@ const useStyles = makeStyles((theme) => ({ [theme.breakpoints.down("md")]: { padding: theme.spacing(1), }, - }, + }), statsLabel: { display: "block", wordWrap: "break-word", }, - statsValue: { + statsValue: (theme) => ({ marginTop: theme.spacing(0.25), display: "flex", wordWrap: "break-word", @@ -85,5 +73,5 @@ const useStyles = makeStyles((theme) => ({ textDecoration: "underline", }, }, - }, -})) + }), +} satisfies Record>; diff --git a/site/src/components/WorkspaceBuildLogs/Logs.tsx b/site/src/components/WorkspaceBuildLogs/Logs.tsx index 7b61183b79726..9fd0d0fe396a4 100644 --- a/site/src/components/WorkspaceBuildLogs/Logs.tsx +++ b/site/src/components/WorkspaceBuildLogs/Logs.tsx @@ -1,10 +1,9 @@ -import { makeStyles } from "@mui/styles"; -import { LogLevel } from "api/typesGenerated"; +import { type Interpolation, type Theme } from "@emotion/react"; +import type { LogLevel } from "api/typesGenerated"; import dayjs from "dayjs"; -import { FC, useMemo } from "react"; -import { MONOSPACE_FONT_FAMILY } from "theme/constants"; -import { combineClasses } from "utils/combineClasses"; +import { type FC, type ReactNode, useMemo } from "react"; import AnsiToHTML from "ansi-to-html"; +import { MONOSPACE_FONT_FAMILY } from "theme/constants"; export interface Line { time: string; @@ -24,19 +23,17 @@ export const Logs: FC> = ({ lines, className = "", }) => { - const styles = useStyles(); - return ( -
-
+
+
{lines.map((line, idx) => ( -
+
{!hideTimestamps && ( <> - + {dayjs(line.time).format(`HH:mm:ss.SSS`)} - + )} {line.output} @@ -56,10 +53,9 @@ export const LogLine: FC<{ hideTimestamp?: boolean; number?: number; style?: React.CSSProperties; - sourceIcon?: JSX.Element; + sourceIcon?: ReactNode; maxNumber?: number; }> = ({ line, hideTimestamp, number, maxNumber, sourceIcon, style }) => { - const styles = useStyles(); const output = useMemo(() => { return convert.toHtml(line.output.split(/\r/g).pop() as string); }, [line.output]); @@ -67,28 +63,22 @@ export const LogLine: FC<{ return (
{sourceIcon} {!hideTimestamp && ( <> {number ? number : dayjs(line.time).format(`HH:mm:ss.SSS`)} - + )} ({ - root: { +const styles = { + root: (theme) => ({ minHeight: 156, padding: theme.spacing(1, 0), borderRadius: theme.shape.borderRadius, @@ -112,11 +102,11 @@ const useStyles = makeStyles((theme) => ({ borderBottom: `1px solid ${theme.palette.divider}`, borderRadius: 0, }, - }, + }), scrollWrapper: { minWidth: "fit-content", }, - line: { + line: (theme) => ({ wordBreak: "break-all", display: "flex", alignItems: "center", @@ -139,24 +129,24 @@ const useStyles = makeStyles((theme) => ({ "&.warn": { backgroundColor: theme.palette.warning.dark, }, - }, - lineNumber: { + }), + lineNumber: (theme) => ({ paddingLeft: theme.spacing(2), - }, - space: { + }), + space: (theme) => ({ userSelect: "none", width: theme.spacing(3), display: "block", flexShrink: 0, - }, - time: { + }), + time: (theme) => ({ userSelect: "none", whiteSpace: "pre", display: "inline-block", color: theme.palette.text.secondary, - }, - number: { + }), + number: (theme) => ({ width: theme.spacing(4), textAlign: "right", - }, -})); + }), +} satisfies Record>; diff --git a/site/src/pages/404Page/404Page.tsx b/site/src/pages/404Page/404Page.tsx index 1d87b26f2bba6..3b842ae153340 100644 --- a/site/src/pages/404Page/404Page.tsx +++ b/site/src/pages/404Page/404Page.tsx @@ -1,13 +1,25 @@ -import { makeStyles } from "@mui/styles"; import Typography from "@mui/material/Typography"; -import { FC } from "react"; +import { type FC } from "react"; export const NotFoundPage: FC = () => { - const styles = useStyles(); - return ( -
-
+
+
({ + margin: theme.spacing(1), + padding: theme.spacing(1), + borderRight: theme.palette.divider, + })} + > 404
This page could not be found. @@ -15,20 +27,4 @@ export const NotFoundPage: FC = () => { ); }; -const useStyles = makeStyles((theme) => ({ - root: { - width: "100%", - height: "100%", - display: "flex", - flexDirection: "row", - justifyContent: "center", - alignItems: "center", - }, - headingContainer: { - margin: theme.spacing(1), - padding: theme.spacing(1), - borderRight: theme.palette.divider, - }, -})); - export default NotFoundPage; diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx index 857c01fc1bcb7..f3594198de4a2 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogDiff/AuditLogDiff.tsx @@ -1,9 +1,8 @@ -import { makeStyles } from "@mui/styles"; -import { AuditLog } from "api/typesGenerated"; +import { type Interpolation, type Theme } from "@emotion/react"; +import { type FC } from "react"; +import type { AuditLog } from "api/typesGenerated"; import { colors } from "theme/colors"; import { MONOSPACE_FONT_FAMILY } from "theme/constants"; -import { combineClasses } from "utils/combineClasses"; -import { FC } from "react"; const getDiffValue = (value: unknown): string => { if (typeof value === "string") { @@ -23,43 +22,32 @@ const getDiffValue = (value: unknown): string => { }; export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => { - const styles = useStyles(); const diffEntries = Object.entries(diff); return ( -
-
+
+
{diffEntries.map(([attrName, valueDiff], index) => ( -
-
{index + 1}
-
-
+
+
{index + 1}
+
-
{attrName}:{" "} - + {valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.old)}
))}
-
+
{diffEntries.map(([attrName, valueDiff], index) => ( -
-
{index + 1}
-
+
+
+
{index + 1}
+
+
{attrName}:{" "} - + {valueDiff.secret ? "••••••••" : getDiffValue(valueDiff.new)}
@@ -70,8 +58,8 @@ export const AuditLogDiff: FC<{ diff: AuditLog["diff"] }> = ({ diff }) => { ); }; -const useStyles = makeStyles((theme) => ({ - diff: { +const styles = { + diff: (theme) => ({ display: "flex", alignItems: "flex-start", fontSize: theme.typography.body2.fontSize, @@ -79,9 +67,9 @@ const useStyles = makeStyles((theme) => ({ fontFamily: MONOSPACE_FONT_FAMILY, position: "relative", zIndex: 2, - }, + }), - diffColumn: { + diffColumn: (theme) => ({ flex: 1, paddingTop: theme.spacing(2), paddingBottom: theme.spacing(2.5), @@ -89,41 +77,41 @@ const useStyles = makeStyles((theme) => ({ lineHeight: "160%", alignSelf: "stretch", overflowWrap: "anywhere", - }, + }), - diffOld: { + diffOld: (theme) => ({ backgroundColor: theme.palette.error.dark, color: theme.palette.error.contrastText, - }, + }), diffRow: { display: "flex", alignItems: "baseline", }, - diffLine: { + diffLine: (theme) => ({ opacity: 0.5, width: theme.spacing(6), textAlign: "right", flexShrink: 0, - }, + }), - diffIcon: { + diffIcon: (theme) => ({ width: theme.spacing(4), textAlign: "center", fontSize: theme.typography.body1.fontSize, flexShrink: 0, - }, + }), - diffNew: { + diffNew: (theme) => ({ backgroundColor: theme.palette.success.dark, color: theme.palette.success.contrastText, - }, + }), - diffValue: { + diffValue: (theme) => ({ padding: 1, borderRadius: theme.shape.borderRadius / 2, - }, + }), diffValueOld: { backgroundColor: colors.red[12], @@ -132,4 +120,4 @@ const useStyles = makeStyles((theme) => ({ diffValueNew: { backgroundColor: colors.green[12], }, -})); +} satisfies Record>; diff --git a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx index dbeefc6d3d56b..8daed04214e8a 100644 --- a/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx +++ b/site/src/pages/AuditPage/AuditLogRow/AuditLogRow.tsx @@ -1,7 +1,7 @@ +import { type CSSObject, type Interpolation, type Theme } from "@emotion/react"; import Collapse from "@mui/material/Collapse"; -import { makeStyles } from "@mui/styles"; import TableCell from "@mui/material/TableCell"; -import { AuditLog } from "api/typesGenerated"; +import type { AuditLog } from "api/typesGenerated"; import { DropdownArrow } from "components/DropdownArrow/DropdownArrow"; import { Pill, type PillType } from "components/Pill/Pill"; import { Stack } from "components/Stack/Stack"; @@ -40,7 +40,6 @@ export const AuditLogRow: React.FC = ({ auditLog, defaultIsDiffOpen = false, }) => { - const styles = useStyles(); const [isDiffOpen, setIsDiffOpen] = useState(defaultIsDiffOpen); const diffs = Object.entries(auditLog.diff); const shouldDisplayDiff = diffs.length > 0; @@ -65,11 +64,11 @@ export const AuditLogRow: React.FC = ({ data-testid={`audit-log-row-${auditLog.id}`} clickable={shouldDisplayDiff} > - + { @@ -81,13 +80,9 @@ export const AuditLogRow: React.FC = ({ - + = ({ {auditLog.is_deleted && ( - + <>(deleted) )} - + {new Date(auditLog.time).toLocaleTimeString()} @@ -119,19 +114,19 @@ export const AuditLogRow: React.FC = ({ {auditLog.ip && ( - + <>IP: {auditLog.ip} )} {os.name && ( - + <>OS: {os.name} )} {browser.name && ( - + <>Browser: {browser.name} {browser.version} @@ -141,7 +136,7 @@ export const AuditLogRow: React.FC = ({ @@ -153,7 +148,7 @@ export const AuditLogRow: React.FC = ({ {shouldDisplayDiff ? (
{}
) : ( -
+
)}
@@ -167,37 +162,37 @@ export const AuditLogRow: React.FC = ({ ); }; -const useStyles = makeStyles((theme) => ({ +const styles = { auditLogCell: { padding: "0 !important", border: 0, }, - auditLogHeader: { + auditLogHeader: (theme) => ({ padding: theme.spacing(2, 4), - }, + }), auditLogHeaderInfo: { flex: 1, }, - auditLogSummary: { - ...theme.typography.body1, + auditLogSummary: (theme) => ({ + ...(theme.typography.body1 as CSSObject), fontFamily: "inherit", - }, + }), - auditLogTime: { + auditLogTime: (theme) => ({ color: theme.palette.text.secondary, fontSize: 12, - }, + }), - auditLogInfo: { - ...theme.typography.body2, + auditLogInfo: (theme) => ({ + ...(theme.typography.body2 as CSSObject), fontSize: 12, fontFamily: "inherit", color: theme.palette.text.secondary, display: "block", - }, + }), // offset the absence of the arrow icon on diff-less logs columnWithoutDiff: { @@ -216,8 +211,8 @@ const useStyles = makeStyles((theme) => ({ fontWeight: 600, }, - deletedLabel: { - ...theme.typography.caption, + deletedLabel: (theme) => ({ + ...(theme.typography.caption as CSSObject), color: theme.palette.text.secondary, - }, -})); + }), +} satisfies Record>; diff --git a/site/src/pages/CliAuthPage/CliAuthPageView.tsx b/site/src/pages/CliAuthPage/CliAuthPageView.tsx index 5253ec721a66e..2eee4f742fe02 100644 --- a/site/src/pages/CliAuthPage/CliAuthPageView.tsx +++ b/site/src/pages/CliAuthPage/CliAuthPageView.tsx @@ -1,10 +1,10 @@ import Button from "@mui/material/Button"; -import { makeStyles } from "@mui/styles"; +import { useTheme } from "@emotion/react"; +import { type FC } from "react"; +import { Link as RouterLink } from "react-router-dom"; import { CodeExample } from "components/CodeExample/CodeExample"; import { SignInLayout } from "components/SignInLayout/SignInLayout"; import { Welcome } from "components/Welcome/Welcome"; -import { FC } from "react"; -import { Link as RouterLink } from "react-router-dom"; import { FullScreenLoader } from "components/Loader/FullScreenLoader"; export interface CliAuthPageViewProps { @@ -12,7 +12,7 @@ export interface CliAuthPageViewProps { } export const CliAuthPageView: FC = ({ sessionToken }) => { - const styles = useStyles(); + const theme = useTheme(); if (!sessionToken) { return ; @@ -22,14 +22,35 @@ export const CliAuthPageView: FC = ({ sessionToken }) => { -

+

Copy the session token below and{" "} - paste it in your terminal. + + paste it in your terminal + + .

-
+
@@ -37,30 +58,3 @@ export const CliAuthPageView: FC = ({ sessionToken }) => { ); }; - -const useStyles = makeStyles((theme) => ({ - title: { - fontSize: theme.spacing(4), - fontWeight: 400, - lineHeight: "140%", - margin: 0, - }, - - text: { - fontSize: 16, - color: theme.palette.text.secondary, - marginBottom: theme.spacing(4), - textAlign: "center", - lineHeight: "160%", - }, - - lineBreak: { - whiteSpace: "nowrap", - }, - - links: { - display: "flex", - justifyContent: "flex-end", - paddingTop: theme.spacing(1), - }, -})); diff --git a/site/src/pages/CreateTemplatePage/VariableInput.tsx b/site/src/pages/CreateTemplatePage/VariableInput.tsx index 012e3c9efbe3e..0ca6807f6b6c7 100644 --- a/site/src/pages/CreateTemplatePage/VariableInput.tsx +++ b/site/src/pages/CreateTemplatePage/VariableInput.tsx @@ -1,28 +1,26 @@ +import { type Interpolation, type Theme } from "@emotion/react"; import FormControlLabel from "@mui/material/FormControlLabel"; import Radio from "@mui/material/Radio"; import RadioGroup from "@mui/material/RadioGroup"; -import { makeStyles } from "@mui/styles"; import TextField from "@mui/material/TextField"; import { Stack } from "components/Stack/Stack"; -import { FC } from "react"; -import { TemplateVersionVariable } from "api/typesGenerated"; +import { type FC } from "react"; +import type { TemplateVersionVariable } from "api/typesGenerated"; const isBoolean = (variable: TemplateVersionVariable) => { return variable.type === "bool"; }; -const VariableLabel: React.FC<{ variable: TemplateVersionVariable }> = ({ +const VariableLabel: FC<{ variable: TemplateVersionVariable }> = ({ variable, }) => { - const styles = useStyles(); - return ( ); }; @@ -40,12 +38,10 @@ export const VariableInput: FC = ({ variable, defaultValue, }) => { - const styles = useStyles(); - return ( -
+
= ({ ); }; -const useStyles = makeStyles((theme) => ({ - labelName: { +const styles = { + labelName: (theme) => ({ fontSize: 14, color: theme.palette.text.secondary, display: "block", marginBottom: theme.spacing(0.5), - }, - labelDescription: { + }), + labelDescription: (theme) => ({ fontSize: 16, color: theme.palette.text.primary, display: "block", fontWeight: 600, - }, + }), input: { display: "flex", flexDirection: "column", }, - checkbox: { - display: "flex", - alignItems: "center", - gap: theme.spacing(1), - }, -})); +} satisfies Record>; diff --git a/site/src/pages/CreateTokenPage/CreateTokenPage.tsx b/site/src/pages/CreateTokenPage/CreateTokenPage.tsx index b965be76a6b78..6da879d4118e3 100644 --- a/site/src/pages/CreateTokenPage/CreateTokenPage.tsx +++ b/site/src/pages/CreateTokenPage/CreateTokenPage.tsx @@ -1,4 +1,4 @@ -import { FC, useState } from "react"; +import { type FC, useState } from "react"; import { Helmet } from "react-helmet-async"; import { pageTitle } from "utils/page"; import { FullPageHorizontalForm } from "components/FullPageForm/FullPageHorizontalForm"; @@ -12,7 +12,6 @@ import { CreateTokenForm } from "./CreateTokenForm"; import { NANO_HOUR, CreateTokenData } from "./utils"; import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog"; import { CodeExample } from "components/CodeExample/CodeExample"; -import { makeStyles } from "@mui/styles"; import { ErrorAlert } from "components/Alert/ErrorAlert"; const initialValues: CreateTokenData = { @@ -21,7 +20,6 @@ const initialValues: CreateTokenData = { }; export const CreateTokenPage: FC = () => { - const styles = useStyles(); const navigate = useNavigate(); const { @@ -72,7 +70,15 @@ export const CreateTokenPage: FC = () => { const tokenDescription = ( <>

Make sure you copy the below token before proceeding:

- + ({ + minHeight: "auto", + userSelect: "all", + width: "100%", + marginTop: theme.spacing(3), + })} + /> ); @@ -114,13 +120,4 @@ export const CreateTokenPage: FC = () => { ); }; -const useStyles = makeStyles((theme) => ({ - codeExample: { - minHeight: "auto", - userSelect: "all", - width: "100%", - marginTop: theme.spacing(3), - }, -})); - export default CreateTokenPage; diff --git a/site/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx b/site/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx index 75d7a55f7a1a7..3a4330eb4cf47 100644 --- a/site/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx +++ b/site/src/pages/DeploySettingsPage/AppearanceSettingsPage/AppearanceSettingsPageView.tsx @@ -12,16 +12,15 @@ import { getFormHelpers } from "utils/formUtils"; import Button from "@mui/material/Button"; import FormControlLabel from "@mui/material/FormControlLabel"; import { BlockPicker } from "react-color"; -import makeStyles from "@mui/styles/makeStyles"; import Switch from "@mui/material/Switch"; import TextField from "@mui/material/TextField"; -import { UpdateAppearanceConfig } from "api/typesGenerated"; +import type { UpdateAppearanceConfig } from "api/typesGenerated"; import { Stack } from "components/Stack/Stack"; import { useFormik } from "formik"; -import { useTheme } from "@mui/styles"; import Link from "@mui/material/Link"; import { colors } from "theme/colors"; import { hslToHex } from "utils/colors"; +import { useTheme } from "@emotion/react"; export type AppearanceSettingsPageViewProps = { appearance: UpdateAppearanceConfig; @@ -39,7 +38,6 @@ export const AppearanceSettingsPageView = ({ isEntitled, onSaveAppearance, }: AppearanceSettingsPageViewProps): JSX.Element => { - const styles = useStyles(); const theme = useTheme(); const applicationNameForm = useFormik<{ @@ -133,7 +131,17 @@ export const AppearanceSettingsPageView = ({ disabled={!isEntitled} InputProps={{ endAdornment: ( - + ); }; - -const useStyles = makeStyles((theme) => ({ - form: { - maxWidth: "500px", - }, - logoAdornment: { - width: theme.spacing(3), - height: theme.spacing(3), - - "& img": { - maxWidth: "100%", - }, - }, -})); diff --git a/site/src/pages/DeploySettingsPage/ExternalAuthSettingsPage/ExternalAuthSettingsPageView.tsx b/site/src/pages/DeploySettingsPage/ExternalAuthSettingsPage/ExternalAuthSettingsPageView.tsx index d3172f05c97a6..59281518f4132 100644 --- a/site/src/pages/DeploySettingsPage/ExternalAuthSettingsPage/ExternalAuthSettingsPageView.tsx +++ b/site/src/pages/DeploySettingsPage/ExternalAuthSettingsPage/ExternalAuthSettingsPageView.tsx @@ -1,11 +1,11 @@ -import { makeStyles } from "@mui/styles"; +import { css, useTheme } from "@emotion/react"; import Table from "@mui/material/Table"; import TableBody from "@mui/material/TableBody"; import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; -import { DeploymentValues, ExternalAuthConfig } from "api/typesGenerated"; +import type { DeploymentValues, ExternalAuthConfig } from "api/typesGenerated"; import { Alert } from "components/Alert/Alert"; import { EnterpriseBadge } from "components/DeploySettingsLayout/Badges"; import { Header } from "components/DeploySettingsLayout/Header"; @@ -18,7 +18,7 @@ export type ExternalAuthSettingsPageViewProps = { export const ExternalAuthSettingsPageView = ({ config, }: ExternalAuthSettingsPageViewProps): JSX.Element => { - const styles = useStyles(); + const theme = useTheme(); return ( <> @@ -40,7 +40,12 @@ export const ExternalAuthSettingsPageView = ({ }} /> -
+
}> Integrating with multiple External authentication providers is an Enterprise feature. @@ -48,7 +53,19 @@ export const ExternalAuthSettingsPageView = ({
- +
ID @@ -61,7 +78,7 @@ export const ExternalAuthSettingsPageView = ({ config.external_auth?.length === 0) && ( -
+
No providers have been configured!
@@ -83,23 +100,3 @@ export const ExternalAuthSettingsPageView = ({ ); }; - -const useStyles = makeStyles((theme) => ({ - table: { - "& td": { - paddingTop: theme.spacing(3), - paddingBottom: theme.spacing(3), - }, - - "& td:last-child, & th:last-child": { - paddingLeft: theme.spacing(4), - }, - }, - description: { - marginTop: theme.spacing(3), - marginBottom: theme.spacing(3), - }, - empty: { - textAlign: "center", - }, -})); diff --git a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/ChartSection.tsx b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/ChartSection.tsx index 45ad3fb5cd8c0..6ba75d0d7ee3a 100644 --- a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/ChartSection.tsx +++ b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/ChartSection.tsx @@ -1,7 +1,11 @@ +import { useTheme } from "@emotion/react"; import Paper from "@mui/material/Paper"; -import { makeStyles } from "@mui/styles"; -import { HTMLProps, ReactNode, FC, PropsWithChildren } from "react"; -import { combineClasses } from "utils/combineClasses"; +import { + type HTMLProps, + type ReactNode, + type FC, + type PropsWithChildren, +} from "react"; export interface ChartSectionProps { /** @@ -18,44 +22,46 @@ export const ChartSection: FC> = ({ contentsProps, title, }) => { - const styles = useStyles(); + const theme = useTheme(); return ( - + {title && ( -
-
{title}
+
+
+ {title} +
{action &&
{action}
}
)}
{children}
); }; - -const useStyles = makeStyles((theme) => ({ - root: { - border: `1px solid ${theme.palette.divider}`, - borderRadius: theme.shape.borderRadius, - }, - contents: { - margin: theme.spacing(2), - }, - header: { - alignItems: "center", - display: "flex", - justifyContent: "space-between", - padding: theme.spacing(1.5, 2), - }, - title: { - margin: 0, - fontSize: 14, - fontWeight: 600, - }, -})); diff --git a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/AddNewLicensePageView.tsx b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/AddNewLicensePageView.tsx index e2156b13c7159..c17e7ca5056d8 100644 --- a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/AddNewLicensePageView.tsx +++ b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/AddNewLicensePageView.tsx @@ -1,16 +1,16 @@ +import { useTheme } from "@emotion/react"; import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; -import { makeStyles } from "@mui/styles"; +import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft"; +import { type FC } from "react"; +import { Link as RouterLink } from "react-router-dom"; import { Fieldset } from "components/DeploySettingsLayout/Fieldset"; import { Header } from "components/DeploySettingsLayout/Header"; import { FileUpload } from "components/FileUpload/FileUpload"; -import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft"; import { displayError } from "components/GlobalSnackbar/utils"; import { Stack } from "components/Stack/Stack"; -import { DividerWithText } from "pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText"; -import { FC } from "react"; -import { Link as RouterLink } from "react-router-dom"; import { ErrorAlert } from "components/Alert/ErrorAlert"; +import { DividerWithText } from "pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText"; type AddNewLicenseProps = { onSaveLicenseKey: (license: string) => void; @@ -23,7 +23,7 @@ export const AddNewLicensePageView: FC = ({ isSavingLicense, savingLicenseError, }) => { - const styles = useStyles(); + const theme = useTheme(); function handleFileUploaded(files: File[]) { const fileReader = new FileReader(); @@ -76,7 +76,7 @@ export const AddNewLicensePageView: FC = ({ description="Select a text file that contains your license key." /> - + or
= ({ ); }; - -const useStyles = makeStyles((theme) => ({ - main: { - paddingTop: theme.spacing(5), - }, -})); diff --git a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText.tsx b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText.tsx index 40bdb47139ce1..2a6346b2c5c0e 100644 --- a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText.tsx +++ b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/DividerWithText.tsx @@ -1,32 +1,31 @@ -import { makeStyles } from "@mui/styles"; -import { FC, PropsWithChildren } from "react"; +import { type Interpolation, type Theme } from "@emotion/react"; +import { type FC, type PropsWithChildren } from "react"; export const DividerWithText: FC = ({ children }) => { - const classes = useStyles(); return ( -
-
- {children} -
+
+
+ {children} +
); }; -const useStyles = makeStyles((theme) => ({ +const styles = { container: { display: "flex", alignItems: "center", }, - border: { + border: (theme) => ({ borderBottom: `2px solid ${theme.palette.divider}`, width: "100%", - }, - content: { + }), + content: (theme) => ({ paddingTop: theme.spacing(0.5), paddingBottom: theme.spacing(0.5), paddingRight: theme.spacing(2), paddingLeft: theme.spacing(2), fontSize: theme.typography.h5.fontSize, color: theme.palette.text.secondary, - }, -})); + }), +} satisfies Record>; diff --git a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx index 682b7c00affec..1e06759207ed7 100644 --- a/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx +++ b/site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicenseCard.tsx @@ -1,13 +1,13 @@ +import { type CSSObject, type Interpolation, type Theme } from "@emotion/react"; import Button from "@mui/material/Button"; import Paper from "@mui/material/Paper"; -import { makeStyles } from "@mui/styles"; -import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog"; -import { Stack } from "components/Stack/Stack"; import dayjs from "dayjs"; import { useState } from "react"; -import { Pill } from "components/Pill/Pill"; import { compareAsc } from "date-fns"; -import { GetLicensesResponse } from "api/api"; +import { type GetLicensesResponse } from "api/api"; +import { ConfirmDialog } from "components/Dialogs/ConfirmDialog/ConfirmDialog"; +import { Pill } from "components/Pill/Pill"; +import { Stack } from "components/Stack/Stack"; type LicenseCardProps = { license: GetLicensesResponse; @@ -24,8 +24,6 @@ export const LicenseCard = ({ onRemove, isRemoving, }: LicenseCardProps) => { - const styles = useStyles(); - const [licenseIDMarkedForRemoval, setLicenseIDMarkedForRemoval] = useState< number | undefined >(undefined); @@ -34,7 +32,7 @@ export const LicenseCard = ({ license.claims.features["user_limit"] || userLimitLimit; return ( - + - #{license.id} - + #{license.id} + {license.claims.trial ? "Trial" : "Enterprise"} - Users - + Users + {userLimitActual} {` / ${currentUserLimit || "Unlimited"}`} @@ -88,15 +86,11 @@ export const LicenseCard = ({ new Date(license.claims.license_expires * 1000), new Date(), ) < 1 ? ( - + ) : ( - Valid Until + Valid Until )} - + {dayjs .unix(license.claims.license_expires) .format("MMMM D, YYYY")} @@ -104,7 +98,7 @@ export const LicenseCard = ({ @@ -213,7 +211,6 @@ const AddGroupMember: React.FC<{ onSubmit: (user: User, reset: () => void) => void; }> = ({ isLoading, onSubmit }) => { const [selectedUser, setSelectedUser] = useState(null); - const styles = useStyles(); const resetValues = () => { setSelectedUser(null); @@ -231,7 +228,7 @@ const AddGroupMember: React.FC<{ > { setSelectedUser(newValue); @@ -312,19 +309,16 @@ const GroupMemberRow = (props: { ); }; -const useStyles = makeStyles((theme) => ({ +const styles = { autoComplete: { width: 300, }, - removeButton: { + removeButton: (theme) => ({ color: theme.palette.error.main, "&:hover": { backgroundColor: "transparent", }, - }, -})); - -const styles = { + }), status: { textTransform: "capitalize", }, diff --git a/site/src/pages/HealthPage/HealthPage.tsx b/site/src/pages/HealthPage/HealthPage.tsx index bba2c2634ddae..6c5ecf05f7b2c 100644 --- a/site/src/pages/HealthPage/HealthPage.tsx +++ b/site/src/pages/HealthPage/HealthPage.tsx @@ -1,3 +1,4 @@ +import { type Interpolation, type Theme } from "@emotion/react"; import Box from "@mui/material/Box"; import { useQuery } from "react-query"; import { getHealth } from "api/api"; @@ -16,7 +17,6 @@ import { PageHeaderSubtitle, } from "components/PageHeader/FullWidthPageHeader"; import { Stats, StatsItem } from "components/Stats/Stats"; -import { makeStyles } from "@mui/styles"; import { createDayString } from "utils/createDayString"; import { DashboardFullPage } from "components/Dashboard/DashboardLayout"; @@ -57,8 +57,6 @@ export function HealthPageView({ healthStatus: Awaited>; tab: ReturnType; }) { - const styles = useStyles(); - return ( @@ -93,14 +91,14 @@ export function HealthPageView({
- + @@ -212,8 +210,8 @@ export function HealthPageView({ ); } -const useStyles = makeStyles((theme) => ({ - stats: { +const styles = { + stats: (theme) => ({ padding: 0, border: 0, gap: theme.spacing(6), @@ -226,7 +224,7 @@ const useStyles = makeStyles((theme) => ({ alignItems: "flex-start", gap: theme.spacing(1), }, - }, + }), statsItem: { flexDirection: "column", @@ -238,4 +236,4 @@ const useStyles = makeStyles((theme) => ({ fontWeight: 500, }, }, -})); +} satisfies Record>; diff --git a/site/src/pages/LoginPage/LoginPageView.tsx b/site/src/pages/LoginPage/LoginPageView.tsx index 520de317c25f9..5363fd61599c6 100644 --- a/site/src/pages/LoginPage/LoginPageView.tsx +++ b/site/src/pages/LoginPage/LoginPageView.tsx @@ -1,11 +1,11 @@ -import { makeStyles } from "@mui/styles"; -import { FC } from "react"; +import { type Interpolation, type Theme } from "@emotion/react"; +import { type FC } from "react"; import { useLocation } from "react-router-dom"; import { SignInForm } from "./SignInForm"; import { retrieveRedirect } from "utils/redirect"; import { CoderIcon } from "components/Icons/CoderIcon"; import { getApplicationName, getLogoURL } from "utils/appearance"; -import { AuthMethods } from "api/typesGenerated"; +import type { AuthMethods } from "api/typesGenerated"; export interface LoginPageViewProps { authMethods: AuthMethods | undefined; @@ -22,7 +22,6 @@ export const LoginPageView: FC = ({ }) => { const location = useLocation(); const redirectTo = retrieveRedirect(location.search); - const styles = useStyles(); // This allows messages to be displayed at the top of the sign in form. // Helpful for any redirects that want to inform the user of something. const info = new URLSearchParams(location.search).get("info") || undefined; @@ -41,12 +40,12 @@ export const LoginPageView: FC = ({ }} /> ) : ( - + ); return ( -
-
+
+
{applicationLogo} = ({ info={info} onSubmit={onSignIn} /> -
+
Copyright © {new Date().getFullYear()} Coder Technologies, Inc.
@@ -64,32 +63,32 @@ export const LoginPageView: FC = ({ ); }; -const useStyles = makeStyles((theme) => ({ - root: { +const styles = { + root: (theme) => ({ padding: theme.spacing(3), display: "flex", alignItems: "center", justifyContent: "center", minHeight: "100%", textAlign: "center", - }, + }), - container: { + container: (theme) => ({ width: "100%", maxWidth: 385, display: "flex", flexDirection: "column", alignItems: "center", gap: theme.spacing(2), - }, + }), - icon: { + icon: (theme) => ({ fontSize: theme.spacing(8), - }, + }), - footer: { + footer: (theme) => ({ fontSize: 12, color: theme.palette.text.secondary, marginTop: theme.spacing(3), - }, -})); + }), +} satisfies Record>; diff --git a/site/src/pages/LoginPage/OAuthSignInForm.tsx b/site/src/pages/LoginPage/OAuthSignInForm.tsx index 0b8515b33e60c..4def9696c9807 100644 --- a/site/src/pages/LoginPage/OAuthSignInForm.tsx +++ b/site/src/pages/LoginPage/OAuthSignInForm.tsx @@ -3,10 +3,10 @@ import Button from "@mui/material/Button"; import GitHubIcon from "@mui/icons-material/GitHub"; import KeyIcon from "@mui/icons-material/VpnKey"; import Box from "@mui/material/Box"; +import { type FC } from "react"; +import { useTheme } from "@emotion/react"; import { Language } from "./SignInForm"; -import { AuthMethods } from "api/typesGenerated"; -import { FC } from "react"; -import { makeStyles } from "@mui/styles"; +import { type AuthMethods } from "api/typesGenerated"; type OAuthSignInFormProps = { isSigningIn: boolean; @@ -14,19 +14,17 @@ type OAuthSignInFormProps = { authMethods?: AuthMethods; }; -const useStyles = makeStyles((theme) => ({ - buttonIcon: { - width: theme.spacing(2), - height: theme.spacing(2), - }, -})); - export const OAuthSignInForm: FC = ({ isSigningIn, redirectTo, authMethods, }) => { - const styles = useStyles(); + const theme = useTheme(); + + const iconStyles = { + width: theme.spacing(2), + height: theme.spacing(2), + }; return ( @@ -37,7 +35,7 @@ export const OAuthSignInForm: FC = ({ )}`} > diff --git a/site/src/pages/TemplatePage/TemplateDocsPage/TemplateDocsPage.tsx b/site/src/pages/TemplatePage/TemplateDocsPage/TemplateDocsPage.tsx index a04052e95db11..728642d0081e7 100644 --- a/site/src/pages/TemplatePage/TemplateDocsPage/TemplateDocsPage.tsx +++ b/site/src/pages/TemplatePage/TemplateDocsPage/TemplateDocsPage.tsx @@ -1,13 +1,13 @@ -import { makeStyles } from "@mui/styles"; -import { MemoizedMarkdown } from "components/Markdown/Markdown"; -import { useTemplateLayoutContext } from "pages/TemplatePage/TemplateLayout"; +import { useTheme } from "@emotion/react"; import frontMatter from "front-matter"; import { Helmet } from "react-helmet-async"; +import { MemoizedMarkdown } from "components/Markdown/Markdown"; +import { useTemplateLayoutContext } from "pages/TemplatePage/TemplateLayout"; import { pageTitle } from "utils/page"; export default function TemplateDocsPage() { const { template, activeVersion } = useTemplateLayoutContext(); - const styles = useStyles(); + const theme = useTheme(); const readme = frontMatter(activeVersion.readme); @@ -17,35 +17,34 @@ export default function TemplateDocsPage() { {pageTitle(`${template.name} · Documentation`)} -
-
README.md
-
+
+
+ README.md +
+
{readme.body}
); } - -export const useStyles = makeStyles((theme) => { - return { - markdownSection: { - background: theme.palette.background.paper, - border: `1px solid ${theme.palette.divider}`, - borderRadius: theme.shape.borderRadius, - }, - - readmeLabel: { - color: theme.palette.text.secondary, - fontWeight: 600, - padding: theme.spacing(2, 3), - borderBottom: `1px solid ${theme.palette.divider}`, - }, - - markdownWrapper: { - padding: theme.spacing(0, 3, 5), - maxWidth: 800, - margin: "auto", - }, - }; -}); diff --git a/site/src/pages/WorkspaceSettingsPage/Sidebar.tsx b/site/src/pages/WorkspaceSettingsPage/Sidebar.tsx index cffa51c4bf619..d146ea2418d1f 100644 --- a/site/src/pages/WorkspaceSettingsPage/Sidebar.tsx +++ b/site/src/pages/WorkspaceSettingsPage/Sidebar.tsx @@ -1,8 +1,19 @@ -import { makeStyles } from "@mui/styles"; +import { css } from "@emotion/css"; +import { + useTheme, + type CSSObject, + type Interpolation, + type Theme, +} from "@emotion/react"; import ScheduleIcon from "@mui/icons-material/TimerOutlined"; -import { Workspace } from "api/typesGenerated"; +import type { Workspace } from "api/typesGenerated"; import { Stack } from "components/Stack/Stack"; -import { FC, ElementType, PropsWithChildren, ReactNode } from "react"; +import { + type FC, + type ComponentType, + type PropsWithChildren, + type ReactNode, +} from "react"; import { Link, NavLink } from "react-router-dom"; import { combineClasses } from "utils/combineClasses"; import GeneralIcon from "@mui/icons-material/SettingsOutlined"; @@ -12,16 +23,47 @@ import { Avatar } from "components/Avatar/Avatar"; const SidebarNavItem: FC< PropsWithChildren<{ href: string; icon: ReactNode }> > = ({ children, href, icon }) => { - const styles = useStyles(); + const theme = useTheme(); + + const linkStyles = css({ + color: "inherit", + display: "block", + fontSize: 14, + textDecoration: "none", + padding: theme.spacing(1.5, 1.5, 1.5, 2), + borderRadius: theme.shape.borderRadius / 2, + transition: "background-color 0.15s ease-in-out", + marginBottom: 1, + position: "relative", + + "&:hover": { + backgroundColor: theme.palette.action.hover, + }, + }); + + const activeLinkStyles = css({ + backgroundColor: theme.palette.action.hover, + + "&:before": { + content: '""', + display: "block", + width: 3, + height: "100%", + position: "absolute", + left: 0, + top: 0, + backgroundColor: theme.palette.secondary.dark, + borderTopLeftRadius: theme.shape.borderRadius, + borderBottomLeftRadius: theme.shape.borderRadius, + }, + }); + return ( - combineClasses([ - styles.sidebarNavItem, - isActive ? styles.sidebarNavItemActive : undefined, - ]) + combineClasses([linkStyles, isActive ? activeLinkStyles : undefined]) } > @@ -32,32 +74,32 @@ const SidebarNavItem: FC< ); }; -const SidebarNavItemIcon: React.FC<{ icon: ElementType }> = ({ - icon: Icon, -}) => { - const styles = useStyles(); - return ; +const SidebarNavItemIcon: FC<{ + icon: ComponentType<{ className?: string }>; +}> = ({ icon: Icon }) => { + return ( + ({ + width: theme.spacing(2), + height: theme.spacing(2), + })} + /> + ); }; export const Sidebar: React.FC<{ username: string; workspace: Workspace }> = ({ username, workspace, }) => { - const styles = useStyles(); - return ( -