Skip to content
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] Migrate /core page to use CSS variables #35366

Merged
merged 56 commits into from
Dec 9, 2022
Merged
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b95669f
fix theme toggle on system mode
siriwatknp Nov 19, 2022
ccc6353
add useCssThemeVars
siriwatknp Nov 21, 2022
f7a160e
refactor styles
siriwatknp Nov 21, 2022
ab06cf1
fix mode and colorScheme
siriwatknp Nov 21, 2022
b1ab089
update AppSearch
siriwatknp Nov 21, 2022
a6fb6c9
fix proptypes to receive array
siriwatknp Nov 22, 2022
aadc4ac
add ttp ignore
siriwatknp Nov 22, 2022
b16d85b
extract useCssThemeVars
siriwatknp Nov 22, 2022
231a5e3
Merge branch 'master' of https://github.com/mui/material-ui into syst…
siriwatknp Nov 23, 2022
3f81fb3
reexport useCssThemeVars from Material UI and Joy UI
siriwatknp Nov 23, 2022
67c9c62
simplify selector
siriwatknp Nov 23, 2022
c688c64
Revert "fix proptypes to receive array"
siriwatknp Nov 23, 2022
c965aa3
set default theme
siriwatknp Nov 23, 2022
a4b24f1
add NestedCssVarsProvider
siriwatknp Nov 23, 2022
f43d41d
add textfield
siriwatknp Nov 23, 2022
4fcb60b
refactor
siriwatknp Nov 24, 2022
4144805
create demos
siriwatknp Nov 24, 2022
16c8175
create new object
siriwatknp Nov 24, 2022
8f8c2d3
fix bug
siriwatknp Nov 24, 2022
6f71f9c
Merge branch 'master' of https://github.com/mui/material-ui into syst…
siriwatknp Nov 25, 2022
676d109
make code review easier
siriwatknp Nov 25, 2022
24fef70
run error-codes
siriwatknp Nov 25, 2022
155b2ee
flatten param
siriwatknp Nov 25, 2022
e85f37a
run prettier
siriwatknp Nov 25, 2022
aa7e3f8
fix logic
siriwatknp Nov 25, 2022
874fbbd
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp Nov 25, 2022
7ccfd39
Merge branch 'system/use-css-theme-vars' into docs/core-css
siriwatknp Nov 25, 2022
048204a
revert changes
siriwatknp Nov 25, 2022
89840c1
support function in NestedCssVarsProvider
siriwatknp Nov 25, 2022
39b7086
update core page
siriwatknp Nov 25, 2022
1b0a6be
update data-grid to latest
siriwatknp Nov 25, 2022
598d091
update DatePicker to latest
siriwatknp Nov 25, 2022
58f9a58
fix x page and components
siriwatknp Nov 25, 2022
f978d94
add flags
siriwatknp Nov 28, 2022
a23a75a
fix demos
siriwatknp Nov 28, 2022
5eefa72
Merge branch 'master' of https://github.com/mui/material-ui into syst…
siriwatknp Dec 2, 2022
3a0e36d
fix logic
siriwatknp Dec 2, 2022
4041321
add regressions
siriwatknp Dec 2, 2022
08979bd
remove experiment
siriwatknp Dec 2, 2022
bb8b29b
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp Dec 2, 2022
e367f55
restore
siriwatknp Dec 2, 2022
ec4a560
Merge branch 'system/disable-style-sheet' into docs/core-css
siriwatknp Dec 2, 2022
2e37967
revert
siriwatknp Dec 2, 2022
c4417f5
update core page
siriwatknp Dec 2, 2022
7ef0152
update x page
siriwatknp Dec 2, 2022
5448300
update component
siriwatknp Dec 3, 2022
b83768c
replace with gap
siriwatknp Dec 3, 2022
6f3f468
Merge branch 'master' of https://github.com/mui/material-ui into docs…
siriwatknp Dec 6, 2022
d892ea2
prevent chrome autofill
siriwatknp Dec 6, 2022
d374060
improve demo
siriwatknp Dec 6, 2022
618fced
remove experiments
siriwatknp Dec 6, 2022
8aba53c
update DatePickers and DataGrid to v6
siriwatknp Dec 6, 2022
efb42ed
update ThemeDatePicker
siriwatknp Dec 6, 2022
e386915
revert x page
siriwatknp Dec 6, 2022
12d3b7b
fix lint
siriwatknp Dec 6, 2022
6914ee2
Update docs/src/components/productCore/CoreComponents.tsx
siriwatknp Dec 8, 2022
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
Next Next commit
fix theme toggle on system mode
  • Loading branch information
siriwatknp committed Nov 19, 2022
commit b95669f115096ef1a97c58b1ff49757ee71e01f3
14 changes: 7 additions & 7 deletions docs/src/components/header/ThemeModeToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ function CssVarsModeToggle(props: { onChange: (checked: boolean) => void }) {
React.useEffect(() => {
setMounted(true);
}, []);
const calculatedMode = mode === 'system' ? systemMode : mode;
return (
<Tooltip title={mode === 'dark' ? 'Turn on the light' : 'Turn off the light'}>
<Tooltip title={calculatedMode === 'dark' ? 'Turn on the light' : 'Turn off the light'}>
<IconButton
color="primary"
disableTouchRipple
disabled={!mode}
disabled={!calculatedMode}
onClick={() => {
props.onChange(mode === 'light' || systemMode === 'light');
setMode(mode === 'dark' ? 'light' : 'dark');
props.onChange(calculatedMode === 'light');
setMode(calculatedMode === 'dark' ? 'light' : 'dark');
}}
>
{!mode || !mounted
{!calculatedMode || !mounted
? null
: {
light: <DarkModeOutlined fontSize="small" />,
system: <DarkModeOutlined fontSize="small" />,
dark: <LightModeOutlined fontSize="small" />,
}[mode]}
}[calculatedMode]}
</IconButton>
</Tooltip>
);
Expand Down