Skip to content

feat: Add Light mode support #1292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 38 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3dadf2a
De-honorable Breadcrumbs
dogmar Dec 15, 2023
29f418f
Bring things in line with plural-console
dogmar Dec 16, 2023
bb4653f
Fix build errors
dogmar Dec 16, 2023
5c2680c
Fix remaining build errors
dogmar Dec 16, 2023
edc63b2
So close
dogmar Dec 16, 2023
005666e
explicity type imports
dogmar Dec 18, 2023
576f7d1
Convert honorable style properties to `css` props for IconFrames
dogmar Dec 18, 2023
cc9c91d
Upgrade design system, revert vite upgrade
dogmar Dec 18, 2023
d3eb81c
lint fix
dogmar Jan 3, 2024
a950a9a
Light mode updates
dogmar Jan 3, 2024
726755e
Update page load spinner to match console
dogmar Jan 3, 2024
b9ef6d0
Remove honorable from RepositoryEdit
dogmar Jan 3, 2024
86349d2
Synchronize theme across windows/tabs
dogmar Jan 3, 2024
4f77c5f
More light mode fixes
dogmar Jan 3, 2024
fd5f144
lint fixes
dogmar Jan 4, 2024
ec95878
More fixes
dogmar Jan 4, 2024
d033c65
radio fixes
dogmar Jan 4, 2024
3e1cd10
lint fix
dogmar Jan 4, 2024
4b41981
Enable editing of dark mode repository icons
dogmar Jan 4, 2024
2a11ea0
Fix up spacing on some AppIcons
dogmar Jan 4, 2024
ded7b77
Fix OnboardingCards for lightmode
dogmar Jan 4, 2024
d917b5c
Make IconUploadPreview `mode` prop optional
dogmar Jan 4, 2024
55d2bfc
Make sure long chip list wraps
dogmar Jan 5, 2024
4c42777
Make package dependency graphs work with theme switching
dogmar Jan 5, 2024
81f27af
Convert Avatar to AppIcon
dogmar Jan 5, 2024
efa553f
lint
dogmar Jan 5, 2024
43b1055
Fix build
dogmar Jan 5, 2024
dcda68f
Fix stylelint errors
dogmar Jan 5, 2024
ebfd313
Use correct extension for eslintrc
dogmar Jan 5, 2024
ff4c83d
lint
dogmar Jan 5, 2024
b03a18d
Upgrade design system
dogmar Jan 5, 2024
9d18305
More Avatar to AppIcon conversion
dogmar Jan 5, 2024
37e5260
Update Sidebar
dogmar Jan 5, 2024
d33eb3c
lint
dogmar Jan 5, 2024
a7b39cd
Remove unneeded style
dogmar Jan 5, 2024
cb4a8dd
De-honorable ImageVulnerabilities
dogmar Jan 5, 2024
2bb8b0d
Replace ‘error’ severities with ‘danger’
dogmar Jan 5, 2024
9486bb3
Fix typo
dogmar Jan 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions www/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script>
const key = 'theme-mode'
function setThemeMode() {
const theme = localStorage.getItem(key) || 'dark'
document.documentElement.setAttribute('data-' + key, theme)
}
window.addEventListener('storage', setThemeMode)
setThemeMode()
</script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000b11" />
Expand Down Expand Up @@ -128,6 +137,10 @@
body {
background-color: #171a21;
}
html[data-theme-mode='light'],
html[data-theme-mode='light'] body {
background-color: #f3f5f7;
}
</style>
<!-- Cookiebot MUST BE FIRST script -->
<script
Expand Down
64 changes: 31 additions & 33 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@
"@nivo/geo": "0.83.0",
"@nivo/line": "0.83.0",
"@octokit/core": "4.2.1",
"@pluralsh/design-system": "3.4.1",
"@react-spring/web": "9.7.2",
"@pluralsh/design-system": "3.16.0",
"@react-spring/web": "9.7.3",
"@stripe/react-stripe-js": "2.1.0",
"@stripe/stripe-js": "1.54.0",
"@testing-library/react": "14.0.0",
"apollo-absinthe-upload-link": "1.7.0",
"babel-plugin-styled-components": "2.1.4",
"browserify-zlib": "0.2.0",
"buffer": "6.0.3",
"country-code-lookup": "0.0.23",
Expand All @@ -60,7 +61,7 @@
"forge-core": "1.4.6",
"fuse.js": "6.6.2",
"git-url-parse": "13.1.0",
"grommet": "2.32.2",
"grommet": "2.34.2",
"history": "5.3.0",
"honorable": "1.0.0-beta.17",
"honorable-recipe-mp": "0.4.0",
Expand All @@ -75,7 +76,6 @@
"process": "0.11.10",
"prop-types": "15.8.1",
"query-string": "8.1.0",
"randomcolor": "0.6.2",
"react": "18.2.0",
"react-animations": "1.0.0",
"react-calendly": "4.1.1",
Expand Down Expand Up @@ -108,7 +108,7 @@
"react-virtualized-auto-sizer": "1.0.20",
"react-window": "1.8.9",
"react-window-reversed": "1.4.1",
"rehype-raw": "6.1.1",
"rehype-raw": "7.0.0",
"slate-history": "0.93.0",
"slate-react": "0.95.0",
"stream-browserify": "3.0.0",
Expand All @@ -131,51 +131,49 @@
"@graphql-codegen/cli": "4.0.1",
"@graphql-codegen/introspection": "4.0.0",
"@graphql-codegen/named-operations-object": "^2.3.1",
"@graphql-codegen/typescript": "4.0.0",
"@graphql-codegen/typescript-operations": "4.0.0",
"@graphql-codegen/typescript-react-apollo": "3.3.7",
"@pluralsh/eslint-config-typescript": "2.5.84",
"@pluralsh/stylelint-config": "1.1.3",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-codegen/typescript-react-apollo": "4.1.0",
"@pluralsh/eslint-config-typescript": "2.5.154",
"@pluralsh/stylelint-config": "2.0.10",
"@types/events": "3.0.0",
"@types/jsdom": "21.1.1",
"@types/randomcolor": "0.5.7",
"@types/jsdom": "21.1.5",
"@types/react": "18.2.8",
"@types/react-credit-cards": "0.8.1",
"@types/react-dom": "18.2.4",
"@types/react-stripe-elements": "6.0.6",
"@types/styled-components": "5.1.26",
"@types/styled-components": "5.1.30",
"@types/uuid": "9.0.1",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@vitejs/plugin-basic-ssl": "1.0.1",
"@vitejs/plugin-react": "4.0.0",
"@vitest/ui": "0.34.3",
"babel-plugin-styled-components": "2.1.4",
"@typescript-eslint/eslint-plugin": "6.17.0",
"@typescript-eslint/parser": "6.17.0",
"@vitejs/plugin-basic-ssl": "1.0.2",
"@vitejs/plugin-react": "4.2.1",
"@vitest/ui": "1.0.4",
"concurrently": "8.1.0",
"eslint": "8.42.0",
"eslint": "8.56.0",
"eslint-config-pluralsh": "3.1.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-import-newlines": "1.3.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.32.2",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import-newlines": "1.3.4",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "8.0.3",
"jsdom": "22.1.0",
"lint-staged": "13.2.2",
"jsdom": "23.0.1",
"lint-staged": "15.2.0",
"npm-run-all": "4.1.5",
"prettier": "2.8.8",
"rollup-plugin-polyfill-node": "0.12.0",
"serve": "14.2.0",
"source-map-explorer": "2.5.3",
"stylelint": "15.7.0",
"stylelint": "15.11.0",
"stylelint-config-prettier": "9.0.5",
"typescript": "5.2.2",
"vite": "4.4.9",
"vite-plugin-pwa": "0.16.3",
"typescript": "5.3.3",
"vite": "4.5.0",
"vite-plugin-pwa": "0.17.4",
"vite-plugin-rewrite-all": "1.0.1",
"vite-tsconfig-paths": "4.2.0",
"vitest": "0.34.3",
"vite-tsconfig-paths": "4.2.2",
"vitest": "1.1.0",
"wait-on": "7.0.1"
},
"lint-staged": {
Expand Down
Binary file removed www/public/app-logo-white.png
Binary file not shown.
Binary file removed www/public/aws-icon.png
Binary file not shown.
Binary file removed www/public/aws.png
Binary file not shown.
Binary file removed www/public/azure.png
Binary file not shown.
Binary file modified www/public/chart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed www/public/equinix-metal.png
Binary file not shown.
Binary file added www/public/header-logo-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/header-logo-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified www/public/kind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed www/public/linode.png
Binary file not shown.
1 change: 1 addition & 0 deletions www/public/page-load-spinner/page-load-spinner-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions www/public/page-load-spinner/page-load-spinner.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@
width: var(--loadingLogoHeight);
height: var(--loadingLogoHeight);
background-color: #ffffff;
mask: url(/logos/plural-logomark-only-white.svg) 0 0 / contain no-repeat;
-webkit-mask: url(/logos/plural-logomark-only-white.svg) 0 0 / contain
mask: url(/page-load-spinner/page-load-spinner-logo.svg) 0 0 / contain no-repeat;
-webkit-mask: url(/page-load-spinner/page-load-spinner-logo.svg) 0 0 / contain
no-repeat;
background: url(/logos/plural-logomark-only-white.svg);
background: url(/page-load-spinner/page-load-spinner-logo.svg);
background-size: contain;
}
@supports (aspect-ratio: 1 / 1) {
Expand Down Expand Up @@ -113,6 +113,9 @@
margin-top: 24px;
text-align: center;
}
html[data-theme-mode='light'] #loading-placeholder h1 {
color: #5d626f;
}

#loading-placeholder .dot {
visibility: hidden;
Expand Down
2 changes: 1 addition & 1 deletion www/public/page-load-spinner/page-load-spinner.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
let tickCount = 0
let tickInterval
const images = [
'/logos/plural-logomark-only-white.svg',
'/page-load-spinner/page-load-spinner-logo.svg',
'/page-load-spinner/page-load-spinner-bg.png',
]

Expand Down
Binary file added www/public/providers/aws-icon-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/aws-icon-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/azure-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/chart-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/equinix-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/gcp-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/kind-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added www/public/providers/linode-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified www/public/terraform.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 52 additions & 34 deletions www/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@ import { Suspense, lazy, useEffect } from 'react'
import { Route, Routes } from 'react-router-dom'
import { ApolloProvider } from '@apollo/client'
import { IntercomProvider } from 'react-use-intercom'
import { Box, Grommet, ThemeType } from 'grommet'
import { Grommet, ThemeType } from 'grommet'
import {
BreadcrumbsProvider,
GlobalStyle,
styledTheme,
theme,
honorableThemeDark,
honorableThemeLight,
styledThemeDark,
styledThemeLight,
useThemeColorMode,
} from '@pluralsh/design-system'
import { MarkdocContextProvider } from '@pluralsh/design-system/dist/markdoc'
import { CssBaseline, ThemeProvider, mergeTheme } from 'honorable'
import { ThemeProvider as StyledThemeProvider } from 'styled-components'
import styled, { ThemeProvider as StyledThemeProvider } from 'styled-components'
import { mergeDeep } from '@apollo/client/utilities'
import mpRecipe from 'honorable-recipe-mp'
import { GrowthBook, GrowthBookProvider } from '@growthbook/growthbook-react'
Expand All @@ -26,6 +29,7 @@ import { growthbook } from './helpers/growthbook'
import Cookiebot from './utils/cookiebot'
import { OverlayContextProvider } from './components/layout/Overlay'
import NavContextProvider from './contexts/NavigationContext'
import { CursorPositionProvider } from './components/utils/CursorPosition'

const Plural = lazy(() => import('./components/Plural'))
const Invite = lazy(() => import('./components/Invite'))
Expand Down Expand Up @@ -75,14 +79,6 @@ const SSOCallback = lazy(() =>
}))
)

const honorableTheme = mergeTheme(theme, {
global: [
// This provides the mp spacing props to honorable
// DEPRECATED in favor of the semantic spacing system
mpRecipe(),
],
})

function PosthogOptInOut() {
useEffect(() => {
if (Cookiebot?.consent?.statistics) {
Expand All @@ -105,7 +101,33 @@ function PosthogOptInOut() {
return null
}

const RootBoxSC = styled.div(({ theme }) => ({
display: 'flex',
flexdirection: 'column',
boxSizing: 'border-box',
maxwidth: '100%',
minwidth: 0,
minHeight: 0,
height: '100vh',
width: '100vw',
outline: 'none',
backgroundColor: theme.colors['fill-zero'],
}))

function App() {
const colorMode = useThemeColorMode()

const honorableTheme = mergeTheme(
colorMode === 'light' ? honorableThemeLight : honorableThemeDark,
{
global: [
// This provides the mp spacing props to honorable
// DEPRECATED in favor of the semantic spacing system
mpRecipe(),
],
}
)
const styledTheme = colorMode === 'light' ? styledThemeLight : styledThemeDark
const mergedStyledTheme = mergeDeep(DEFAULT_THEME, styledTheme)

const routes = (
Expand Down Expand Up @@ -175,29 +197,25 @@ function App() {
<ThemeProvider theme={honorableTheme}>
<StyledThemeProvider theme={mergedStyledTheme}>
<GrowthBookProvider growthbook={growthbook as any as GrowthBook}>
<MarkdocContextProvider value={{ variant: 'console' }}>
<NavContextProvider>
<OverlayContextProvider>
<BreadcrumbsProvider>
<CssBaseline />
<GlobalStyle />
<Grommet
full
theme={mergedStyledTheme as any as ThemeType}
themeMode="dark"
>
<Box
width="100vw"
height="100vh"
background="#171A21"
<CursorPositionProvider>
<MarkdocContextProvider value={{ variant: 'console' }}>
<NavContextProvider>
<OverlayContextProvider>
<BreadcrumbsProvider>
<CssBaseline />
<GlobalStyle />
<Grommet
full
theme={mergedStyledTheme as any as ThemeType}
themeMode="dark"
>
{routes}
</Box>
</Grommet>
</BreadcrumbsProvider>
</OverlayContextProvider>
</NavContextProvider>
</MarkdocContextProvider>
<RootBoxSC>{routes}</RootBoxSC>
</Grommet>
</BreadcrumbsProvider>
</OverlayContextProvider>
</NavContextProvider>
</MarkdocContextProvider>
</CursorPositionProvider>
</GrowthBookProvider>
</StyledThemeProvider>
</ThemeProvider>
Expand Down
23 changes: 0 additions & 23 deletions www/src/_deprecated/components/repos/constants.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
export const DEFAULT_CHART_ICON = '/chart.png'
export const DEFAULT_TF_ICON = '/terraform.png'
export const DEFAULT_DKR_ICON = '/docker.png'
export const DEFAULT_GCP_ICON = '/gcp.png'
export const DEFAULT_AZURE_ICON = '/azure.png'
export const DEFAULT_AWS_ICON = '/aws.png'
export const DEFAULT_EQUINIX_ICON = '/equinix-metal.png'
export const DEFAULT_KIND_ICON = '/kind.png'
export const DARK_AWS_ICON = '/aws-icon.png'

export const ProviderIcons = {
GCP: DEFAULT_GCP_ICON,
AWS: DEFAULT_AWS_ICON,
AZURE: DEFAULT_AZURE_ICON,
EQUINIX: DEFAULT_EQUINIX_ICON,
KIND: DEFAULT_KIND_ICON,
GENERIC: DEFAULT_CHART_ICON,
}

export const DarkProviderIcons = {
AWS: DARK_AWS_ICON,
}

export const Categories = {
DEVOPS: 'DEVOPS',
DATABASE: 'DATABASE',
Expand Down
4 changes: 2 additions & 2 deletions www/src/components/Invite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useState } from 'react'
import { useParams } from 'react-router-dom'

import {
Invite as InviteT,
User,
type Invite as InviteT,
type User,
useInviteQuery,
useRealizeInviteMutation,
useSignupInviteMutation,
Expand Down
16 changes: 8 additions & 8 deletions www/src/components/account/DnsRecords.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useMutation, useQuery } from '@apollo/client'
import { Box } from 'grommet'
import { Avatar, Button, Div, Flex, Span } from 'honorable'
import { Button, Div, Flex, Span } from 'honorable'
import moment from 'moment'
import { useState } from 'react'
import { ArrowLeftIcon } from '@pluralsh/design-system'
import { AppIcon, ArrowLeftIcon } from '@pluralsh/design-system'

import { Placeholder } from '../utils/Placeholder'
import {
Expand All @@ -16,7 +16,6 @@ import { DeleteIconButton } from '../utils/IconButtons'
import { StandardScroller } from '../utils/SmoothScroller'
import { Table, TableData, TableRow } from '../utils/Table'
import { ProviderIcon } from '../utils/ProviderIcon'

import { Confirm } from '../utils/Confirm'

import { DELETE_DNS_RECORD, DNS_RECORDS } from './queries'
Expand Down Expand Up @@ -153,12 +152,13 @@ export function DnsRecords({ domain, setDomain }: any) {
gap="xsmall"
align="center"
>
<Avatar
src={node.creator.avatar}
name={node.creator.name}
size={30}
<AppIcon
url={node?.creator?.avatar || undefined}
name={node.creator?.name || undefined}
size="xxsmall"
spacing={node?.creator?.avatar ? 'none' : undefined}
/>
<Span color="text-light">{node.creator.name}</Span>
<Span color="text-light">{node.creator?.name}</Span>
</Box>
</TableData>
</TableRow>
Expand Down
Loading