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

[docs] Add Joy default theme viewer #35554

Merged
merged 44 commits into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
db6321e
move to tools
siriwatknp Dec 21, 2022
bf77c4d
add PaletteThemeViewer
siriwatknp Dec 21, 2022
7e7b273
update viewer
siriwatknp Dec 21, 2022
159bca9
add ShadowThemeViewer
siriwatknp Dec 21, 2022
8731588
update types
siriwatknp Dec 21, 2022
ada92b8
update
siriwatknp Dec 21, 2022
90f1685
update content
siriwatknp Dec 21, 2022
89d4a91
update
siriwatknp Dec 21, 2022
6415086
exclude mode
siriwatknp Dec 21, 2022
074d1e3
update content
siriwatknp Dec 21, 2022
6ad6043
add JoyDefaultTheme explorer
siriwatknp Dec 22, 2022
d55e241
update
siriwatknp Dec 22, 2022
57e46a3
fix lint
siriwatknp Dec 22, 2022
b721d8f
extract ThemeViewer
siriwatknp Dec 23, 2022
72b5a3a
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Dec 23, 2022
333360c
move typography viewer to another page
siriwatknp Dec 23, 2022
4c58894
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Jan 3, 2023
06d5141
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Jan 4, 2023
0b6a186
move to customization
siriwatknp Jan 4, 2023
35f267e
add theme shadow page
siriwatknp Jan 4, 2023
3cc6304
update shadow viewer
siriwatknp Jan 4, 2023
63cf079
adjust palette theme viewer table
siriwatknp Jan 4, 2023
ac9a5f2
complete theme colors
siriwatknp Jan 5, 2023
199596b
remove theme-tokens
siriwatknp Jan 5, 2023
b7e9dc5
adjust table styles
siriwatknp Jan 5, 2023
2203701
update theme shadow
siriwatknp Jan 5, 2023
9cef07f
remove broken link
siriwatknp Jan 5, 2023
c19d6e8
update content
siriwatknp Jan 5, 2023
400e462
Improve Material UI page title too
oliviertassinari Jan 9, 2023
78efd27
no horizontal scrollbar
oliviertassinari Jan 9, 2023
c7ef2fa
remove legacy expend-path URL query param
oliviertassinari Jan 9, 2023
346a573
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Jan 9, 2023
35ab9f0
udpate content
siriwatknp Jan 9, 2023
5bfca44
update sidebar
siriwatknp Jan 9, 2023
7629344
use code font family
siriwatknp Jan 9, 2023
a57ce37
Merge branch 'joy/default-theme-explorer' of github.com:siriwatknp/ma…
siriwatknp Jan 9, 2023
936db2e
Apply suggestions from code review
siriwatknp Jan 10, 2023
4099d5d
update shadow warning
siriwatknp Jan 10, 2023
94d7c53
run prettier
siriwatknp Jan 10, 2023
1164962
shorten comment
siriwatknp Jan 10, 2023
65a5c3c
add copy functionality
siriwatknp Jan 17, 2023
1f90150
Merge branch 'master' of https://github.com/mui/material-ui into joy/…
siriwatknp Jan 24, 2023
247414f
fix scroll bar
siriwatknp Jan 24, 2023
815a227
fix lint
siriwatknp Jan 24, 2023
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
2 changes: 1 addition & 1 deletion docs/data/joy/customization/approaches/approaches.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Here are some examples that reproduce popular designs (only the light mode, thou

### Customizing theme tokens

Theme tokens refer to both [_low-level_ and _global variant_ design tokens](/joy-ui/customization/theme-tokens/).
Theme tokens refer to both _low-level_ and _global variant_ design tokens.

For example, instead of assigning the same hex code every time you want to change a given component's background color, you assign a theme token instead.
If, at any point, you want to change that, you'd change in one place only, ensuring you consistency across all the components that use that theme token.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import * as React from 'react';
import { extendTheme } from '@mui/joy/styles';
import Box from '@mui/joy/Box';
import { ThemeProvider, createTheme } from '@mui/material/styles';
import ThemeViewer, {
useNodeIdsLazy,
} from 'docs/src/modules/components/ThemeViewer';

const defaultTheme = extendTheme();

export default function JoyDefaultTheme() {
const [expandPaths, setExpandPaths] = React.useState(null);

React.useEffect(() => {
let expandPath;
decodeURI(document.location.search.slice(1))
.split('&')
.forEach((param) => {
const [name, value] = param.split('=');
if (name === 'expand-path') {
expandPath = value;
}
});

if (!expandPath) {
return;
}

setExpandPaths(
expandPath
.replace('$.', '')
.split('.')
.reduce((acc, path) => {
const last = acc.length > 0 ? `${acc[acc.length - 1]}.` : '';
acc.push(last + path);
return acc;
}, []),
);
}, []);

const data = defaultTheme;
const allNodeIds = useNodeIdsLazy(data);
React.useDebugValue(allNodeIds);

return (
<Box sx={{ width: '100%' }}>
<ThemeProvider theme={() => createTheme()}>
<ThemeViewer data={data} expandPaths={expandPaths} />
</ThemeProvider>
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Default theme viewer

<p class="description">Here's what the theme object looks like with the default values.</p>

:::warning
This is a work in progress. We're still iterating on Joy UI's default theme.
:::

## Explore

Explore the default theme:

{{"demo": "JoyDefaultTheme.js", "hideToolbar": true, "bg": "inline"}}

To create your own theme, starts with customizing the [theme colors](/joy-ui/customization/theme-colors/).
100 changes: 0 additions & 100 deletions docs/data/joy/customization/default-theme/default-theme-pt.md

This file was deleted.

100 changes: 0 additions & 100 deletions docs/data/joy/customization/default-theme/default-theme-zh.md

This file was deleted.

101 changes: 0 additions & 101 deletions docs/data/joy/customization/default-theme/default-theme.md

This file was deleted.

Loading