From ebd6c1b573ad9fd6542c9fef76b32d3837797eca Mon Sep 17 00:00:00 2001 From: Kayla Washburn Date: Fri, 8 Dec 2023 14:38:35 -0700 Subject: [PATCH] feat(site): bring back dark blue (#11071) --- site/.storybook/main.js | 1 - site/.storybook/preview.jsx | 12 +- site/src/@types/emotion.d.ts | 4 +- site/src/@types/mui.d.ts | 6 - site/src/App.tsx | 12 +- .../DeploymentBanner/DeploymentBannerView.tsx | 12 +- .../LicenseBanner/LicenseBannerView.tsx | 13 +- .../Dashboard/Navbar/NavbarView.tsx | 17 +- .../Navbar/UserDropdown/UserDropdown.tsx | 78 +-- .../ServiceBanner/ServiceBannerView.tsx | 3 +- site/src/components/IconField/IconField.tsx | 5 +- site/src/components/Pill/Pill.tsx | 9 +- site/src/components/Resources/AgentRow.tsx | 5 +- .../Resources/PortForwardButton.tsx | 7 +- .../AppearanceSettingsPageView.tsx | 14 +- .../TemplateInsightsPage.tsx | 3 +- .../TemplateVersionsPage/VersionRow.tsx | 12 +- .../FileTreeView.tsx | 23 +- .../pages/TemplatesPage/EmptyTemplates.tsx | 6 +- .../pages/TemplatesPage/TemplatesPageView.tsx | 3 +- site/src/pages/TerminalPage/TerminalPage.tsx | 15 +- site/src/pages/WorkspaceBuildPage/Sidebar.tsx | 3 +- .../WorkspaceDeleteDialog.tsx | 127 ++-- site/src/pages/WorkspacesPage/LastUsed.tsx | 5 +- site/src/theme/colors.ts | 98 ++-- site/src/theme/dark/colors.ts | 62 ++ site/src/theme/dark/experimental.ts | 130 +++++ site/src/theme/dark/index.ts | 9 + site/src/theme/dark/mui.ts | 551 ++++++++++++++++++ site/src/theme/darkBlue/colors.ts | 62 ++ site/src/theme/darkBlue/experimental.ts | 130 +++++ site/src/theme/darkBlue/index.ts | 9 + site/src/theme/darkBlue/mui.ts | 551 ++++++++++++++++++ site/src/theme/experimental.ts | 134 +---- site/src/theme/index.ts | 17 + site/src/theme/mui.ts | 546 ----------------- 36 files changed, 1762 insertions(+), 932 deletions(-) create mode 100644 site/src/theme/dark/colors.ts create mode 100644 site/src/theme/dark/experimental.ts create mode 100644 site/src/theme/dark/index.ts create mode 100644 site/src/theme/dark/mui.ts create mode 100644 site/src/theme/darkBlue/colors.ts create mode 100644 site/src/theme/darkBlue/experimental.ts create mode 100644 site/src/theme/darkBlue/index.ts create mode 100644 site/src/theme/darkBlue/mui.ts create mode 100644 site/src/theme/index.ts diff --git a/site/.storybook/main.js b/site/.storybook/main.js index 172d61b22a..f955a9a2d9 100644 --- a/site/.storybook/main.js +++ b/site/.storybook/main.js @@ -1,5 +1,4 @@ import turbosnap from "vite-plugin-turbosnap"; -import { mergeConfig } from "vite"; module.exports = { stories: ["../src/**/*.stories.tsx"], diff --git a/site/.storybook/preview.jsx b/site/.storybook/preview.jsx index 5fd8b17e7b..2a687e27cd 100644 --- a/site/.storybook/preview.jsx +++ b/site/.storybook/preview.jsx @@ -6,22 +6,16 @@ import { import { ThemeProvider as EmotionThemeProvider } from "@emotion/react"; import { withRouter } from "storybook-addon-react-router-v6"; import { HelmetProvider } from "react-helmet-async"; -import { dark } from "theme/mui"; -import { dark as experimental } from "theme/experimental"; +import theme from "theme"; import colors from "theme/tailwind"; import "theme/globalFonts"; import { QueryClient, QueryClientProvider } from "react-query"; -const theme = { - ...dark, - experimental, -}; - export const decorators = [ (Story) => ( - - + + diff --git a/site/src/@types/emotion.d.ts b/site/src/@types/emotion.d.ts index 3e6adf9cd8..57123a0796 100644 --- a/site/src/@types/emotion.d.ts +++ b/site/src/@types/emotion.d.ts @@ -1,5 +1,5 @@ -import type { Theme as MuiTheme } from "@mui/material/styles"; +import type { Theme as CoderTheme } from "theme"; declare module "@emotion/react" { - interface Theme extends MuiTheme {} + interface Theme extends CoderTheme {} } diff --git a/site/src/@types/mui.d.ts b/site/src/@types/mui.d.ts index 17abc0aa2d..4017af0f1b 100644 --- a/site/src/@types/mui.d.ts +++ b/site/src/@types/mui.d.ts @@ -24,9 +24,3 @@ declare module "@mui/material/Button" { xlarge: true; } } - -declare module "@mui/system" { - interface Theme { - experimental: NewTheme; - } -} diff --git a/site/src/App.tsx b/site/src/App.tsx index 7fa09d271d..1f14476769 100644 --- a/site/src/App.tsx +++ b/site/src/App.tsx @@ -6,8 +6,7 @@ import { HelmetProvider } from "react-helmet-async"; import { AppRouter } from "./AppRouter"; import { ErrorBoundary } from "./components/ErrorBoundary/ErrorBoundary"; import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar"; -import { dark } from "./theme/mui"; -import { dark as experimental } from "./theme/experimental"; +import theme from "./theme"; import "./theme/globalFonts"; import { StyledEngineProvider, @@ -30,16 +29,11 @@ const defaultQueryClient = new QueryClient({ }, }); -const theme = { - ...dark, - experimental, -}; - export const ThemeProviders: FC = ({ children }) => { return ( - - + + {children} diff --git a/site/src/components/Dashboard/DeploymentBanner/DeploymentBannerView.tsx b/site/src/components/Dashboard/DeploymentBanner/DeploymentBannerView.tsx index 8c5b154b4e..1cb105118e 100644 --- a/site/src/components/Dashboard/DeploymentBanner/DeploymentBannerView.tsx +++ b/site/src/components/Dashboard/DeploymentBanner/DeploymentBannerView.tsx @@ -37,7 +37,6 @@ import { RocketIcon } from "components/Icons/RocketIcon"; import ErrorIcon from "@mui/icons-material/ErrorOutline"; import { MONOSPACE_FONT_FAMILY } from "theme/constants"; import { getDisplayWorkspaceStatus } from "utils/workspace"; -import { colors } from "theme/colors"; import { HelpTooltipTitle } from "components/HelpTooltip/HelpTooltip"; import { Stack } from "components/Stack/Stack"; import { type ClassName, useClassName } from "hooks/useClassName"; @@ -373,9 +372,14 @@ const ValueSeparator: FC = () => { }; const HealthIssue: FC = ({ children }) => { + const theme = useTheme(); + return ( - + {children} ); @@ -435,8 +439,8 @@ const styles = { height: 16px; } `, - unhealthy: css` - background-color: ${colors.red[10]}; + unhealthy: (theme) => css` + background-color: ${theme.colors.red[10]}; `, group: css` display: flex; diff --git a/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx b/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx index daec3210cd..7e3889fceb 100644 --- a/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx +++ b/site/src/components/Dashboard/LicenseBanner/LicenseBannerView.tsx @@ -1,15 +1,14 @@ +import Link from "@mui/material/Link"; import { + css, type CSSObject, type Interpolation, type Theme, useTheme, } from "@emotion/react"; -import Link from "@mui/material/Link"; -import { css } from "@emotion/react"; -import { useState } from "react"; +import { type FC, useState } from "react"; import { Expander } from "components/Expander/Expander"; import { Pill } from "components/Pill/Pill"; -import { colors } from "theme/colors"; export const Language = { licenseIssue: "License Issue", @@ -32,7 +31,7 @@ export interface LicenseBannerViewProps { warnings: string[]; } -export const LicenseBannerView: React.FC = ({ +export const LicenseBannerView: FC = ({ errors, warnings, }) => { @@ -48,7 +47,9 @@ export const LicenseBannerView: React.FC = ({ display: flex; align-items: center; padding: 12px; - background-color: ${type === "error" ? colors.red[10] : colors.orange[10]}; + background-color: ${type === "error" + ? theme.colors.red[10] + : theme.colors.orange[10]}; `; if (messages.length === 1) { diff --git a/site/src/components/Dashboard/Navbar/NavbarView.tsx b/site/src/components/Dashboard/Navbar/NavbarView.tsx index 25340c1198..56b5bdbf73 100644 --- a/site/src/components/Dashboard/Navbar/NavbarView.tsx +++ b/site/src/components/Dashboard/Navbar/NavbarView.tsx @@ -10,13 +10,12 @@ import MenuIcon from "@mui/icons-material/Menu"; import { css, type Interpolation, type Theme, useTheme } from "@emotion/react"; import { type FC, type ReactNode, useRef, useState } from "react"; import { NavLink, useLocation, useNavigate } from "react-router-dom"; -import { colors } from "theme/colors"; -import type * as TypesGen from "api/typesGenerated"; import { BUTTON_SM_HEIGHT, navHeight } from "theme/constants"; -import { ProxyContextValue } from "contexts/ProxyContext"; +import type * as TypesGen from "api/typesGenerated"; +import type { ProxyContextValue } from "contexts/ProxyContext"; import { displayError } from "components/GlobalSnackbar/utils"; -import { CoderIcon } from "components/Icons/CoderIcon"; import { ProxyStatusLatency } from "components/ProxyStatusLatency/ProxyStatusLatency"; +import { CoderIcon } from "components/Icons/CoderIcon"; import { usePermissions } from "hooks/usePermissions"; import { UserDropdown } from "./UserDropdown/UserDropdown"; @@ -124,8 +123,8 @@ export const NavbarView: FC = ({