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
[website] Fix home page dark mode flicker #33545
Merged
Merged
Changes from all commits
Commits
Show all changes
144 commits
Select commit
Hold shift + click to select a range
25cee16
create BrandingCssVarsProvider
siriwatknp 048c826
replace with Css vars
siriwatknp f9faf82
update task card
siriwatknp 7ed9c48
add resolveTheme prop
siriwatknp 7c70d83
use CSS variables in Button theme
siriwatknp ca526f6
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 9ae7cb5
add getInitColorSchemeScript to index
siriwatknp 1ddc314
adjust ssr toggle mode
siriwatknp 0e838bf
fix display1 color
siriwatknp fdc2244
update IconButton branding theme
siriwatknp 6980915
update Menu branding theme
siriwatknp ca82846
update Popover branding theme
siriwatknp 46b015f
update Divider, Link brandingTheme
siriwatknp 0f51305
update Chip, TableCell, ToggleButtonGroup branding theme
siriwatknp 6221a07
update ToggleButton branding theme
siriwatknp 3307249
update Switch, Pagination branding theme
siriwatknp 84d9e39
add getMuiInitColorSchemeScript to _document
siriwatknp 6203813
update AppHeader
siriwatknp c9364f2
update Paper theme
siriwatknp eec0711
fix button theme
siriwatknp 0f868bc
update homepage theme
siriwatknp bcf5bdd
use callback syntax
siriwatknp c428aa2
remove theme argument
siriwatknp 2b83a8d
remove resolveTheme from prop
siriwatknp eca4e88
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 06103a0
fix types
siriwatknp cd73a4c
update ThemeToggleButton
siriwatknp 8acdb09
update ThemeSwitch
siriwatknp a4ff446
update ThemeChip
siriwatknp 4b6dc1e
update ThemeTimeline
siriwatknp a408db7
update ThemeDatePicker
siriwatknp 2f6ccc4
adjust styles
siriwatknp 1f291ed
update ThemeTabs
siriwatknp 4c2963a
update ThemeSlider
siriwatknp e123b69
update NotificationCard
siriwatknp 5e3e76d
update ThemeAccordion
siriwatknp eba12c7
minor fix styles
siriwatknp 0bc86a1
create first set of variables
siriwatknp 63cf0c5
fix StylingInfo
siriwatknp 6d29b50
Fix CoreShowcase
siriwatknp 26e0d16
Update Testimonials
siriwatknp e9b8934
update PlayerCard
siriwatknp 9a1526e
fix components ssr
siriwatknp 0d8b5b1
Fix all SSR hydration mismatch
siriwatknp d675938
add getStyle util
siriwatknp eec94fa
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp ead1c86
simplify code
siriwatknp 32dad42
fix typo
siriwatknp 5198539
Merge branch 'master' into docs/home-improve
siriwatknp d4bdda7
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp c82254c
refactor getStyle
siriwatknp 0a600e0
add disableTransitionOnChange
siriwatknp 720cf92
add comment
siriwatknp bb46f5a
fix EmailSubscribe
siriwatknp 1687f91
use specific values
siriwatknp 12a2b80
fix styles
siriwatknp 85f9b3b
refactor getStyle
siriwatknp b9dc946
fix color
siriwatknp bf88a94
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 2a683dc
add custom stylis plugins
siriwatknp 6e17c5e
use :where selector
siriwatknp 09931d0
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp f67d32c
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 567fc7a
use getColorSchemeSelector in components
siriwatknp 95a75fd
fix brandingTheme
siriwatknp d3e8c5b
use applyDarkStyles
siriwatknp ef4809a
fix
siriwatknp ae7e79a
fix edge cases
siriwatknp 09cc30c
sync local storage with other pages
siriwatknp e8bb374
fix style
siriwatknp c7b6299
remove custom tokens
siriwatknp 5b67285
revert change
siriwatknp 7eea262
use applyDarkStyles
siriwatknp dfad161
remove custom keys
siriwatknp e84faea
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 35d4f53
exclude vars
siriwatknp f27c144
remove unnecessary color scheme
siriwatknp 439fc56
syncing local storage with the homepage
siriwatknp 5271159
fix variables
siriwatknp 0178970
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 9b5a49d
remove unnecessary tokens
siriwatknp 906c5a0
remove joy color scheme script setup
siriwatknp 5276619
fix color scheme reset
siriwatknp ce247db
revert change
siriwatknp 3d84d40
ensure consistent color-scheme
siriwatknp 76b5e8b
add box-shadow
siriwatknp 1712381
prettier
siriwatknp 3b92ce5
make all marketing components use theme.applyDarkStyles
siriwatknp 962bab6
add comment
siriwatknp 88bd060
add resolved mode and add comments
siriwatknp b1fa4d8
remove unnecessary enableColorScheme
siriwatknp 1964a6b
use palette.mode as color-scheme
siriwatknp b69e21b
add mode to palette in joy
siriwatknp d971b0b
remove enableColorScheme test (moved to regression)
siriwatknp 119858c
fix joy dark mode
siriwatknp c1ae81a
remove omit
siriwatknp fd3268c
add initial setup from design system
siriwatknp 317b915
revert to make code review easier
siriwatknp 4376b81
Merge branch 'system/fix-server-mode' into docs/home-improve
siriwatknp 51fa80e
move enable color scheme to CssBaseline
siriwatknp a79c794
Add CssBaseline to Joy
siriwatknp 0e9a4a0
Merge branch 'system/fix-server-mode' into docs/home-improve
siriwatknp e2bbb60
remove color scheme inline style
siriwatknp 8885f0f
fix color scheme styles generation
siriwatknp eea5765
Remove workaround adjustment
siriwatknp 1da43e6
run proptypes
siriwatknp e47b24e
fix lint
siriwatknp b5da1b6
run proptypes
siriwatknp 88b48f7
fix lint
siriwatknp 23c27ee
fix backdrop color
siriwatknp bea2b11
fix Joy color scheme styles
siriwatknp 784a5f6
add visual regression
siriwatknp 4ae0ff0
fix color scheme styles generation
siriwatknp d7456f9
fix implementation
siriwatknp 4187694
apply logic to ScopedCssBaseline
siriwatknp fb0a14b
update regression
siriwatknp 65eaac9
fix mui CssBaseline
siriwatknp c07acb7
Merge branch 'system/fix-server-mode' into docs/home-improve
siriwatknp 50fe080
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 6fa572a
restore changes
siriwatknp d65c8bf
Remove unnecessary workaround
siriwatknp 24b2751
remove outdated param
siriwatknp db9c81c
Remove paletteMode from cookie
siriwatknp 7a22541
sync modes
siriwatknp 7c02d2e
Fix description
oliviertassinari e9d99c4
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 3315cb7
refactor to function syntax
siriwatknp 3fdaa08
remove repeatitive logic
siriwatknp ef8171f
Merge branch 'docs/home-improve' of github.com:siriwatknp/material-ui…
siriwatknp 0bb0546
fix hydration mismatch
siriwatknp 857d5ab
force `vars` to be null
siriwatknp b164c9d
fix layout shift and precise why
oliviertassinari 4529fc4
use try catch
siriwatknp 83f2ece
use :where selector
siriwatknp 02382a5
use applyDarkStyles
siriwatknp 15baccb
fix lineHeight
siriwatknp c8371d6
use applyDarkStyles
siriwatknp 0a0e25f
add grey palette
siriwatknp fa8b232
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp fc7e12a
use applyDarkStyles
siriwatknp f51f4d4
Merge branch 'docs/home-improve' of github.com:siriwatknp/material-ui…
siriwatknp adfbbd3
fix lint
siriwatknp ff770b0
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp 6fd0753
fix unsupported arg
siriwatknp File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import * as React from 'react'; | ||
import { deepmerge } from '@mui/utils'; | ||
import { | ||
Experimental_CssVarsProvider as CssVarsProvider, | ||
experimental_extendTheme as extendTheme, | ||
PaletteColorOptions, | ||
} from '@mui/material/styles'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import { NextNProgressBar } from 'docs/src/modules/components/AppFrame'; | ||
import { getDesignTokens, getThemedComponents } from 'docs/src/modules/brandingTheme'; | ||
|
||
declare module '@mui/material/styles' { | ||
interface PaletteOptions { | ||
primaryDark?: PaletteColorOptions; | ||
} | ||
} | ||
|
||
const { palette: lightPalette, typography, ...designTokens } = getDesignTokens('light'); | ||
const { palette: darkPalette } = getDesignTokens('dark'); | ||
|
||
const theme = extendTheme({ | ||
cssVarPrefix: 'muidocs', | ||
colorSchemes: { | ||
light: { | ||
palette: lightPalette, | ||
}, | ||
dark: { | ||
palette: darkPalette, | ||
}, | ||
}, | ||
...designTokens, | ||
typography: deepmerge(typography, { | ||
h1: { | ||
':where([data-mui-color-scheme="dark"]) &': { | ||
color: 'initial', | ||
}, | ||
}, | ||
h2: { | ||
':where([data-mui-color-scheme="dark"]) &': { | ||
color: 'var(--muidocs-palette-grey-100)', | ||
}, | ||
}, | ||
h5: { | ||
':where([data-mui-color-scheme="dark"]) &': { | ||
color: 'var(--muidocs-palette-primary-300)', | ||
}, | ||
}, | ||
}), | ||
...getThemedComponents(), | ||
}); | ||
|
||
export default function BrandingCssVarsProvider({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<CssVarsProvider theme={theme} disableTransitionOnChange> | ||
<NextNProgressBar /> | ||
<CssBaseline /> | ||
{children} | ||
</CssVarsProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify the logic and remove deepmerge calculation.