-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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 CodeSandbox/Stackblitz to the rest of the templates #43708
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
6a69cf5
update checkout template
siriwatknp 273cb02
update marketing page
siriwatknp 9a709c2
update sign-in-side template
siriwatknp 43b36e7
update sign-up
siriwatknp 4c28a7f
update blog
siriwatknp 29907fa
use CSS theme variables
siriwatknp 0b1cf8f
fix all issues
siriwatknp e33ef1d
update screenshots
siriwatknp e710571
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp 790fcc2
fallback to theme
siriwatknp 5935047
fix grid xs
siriwatknp 22b0be0
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp 53dc463
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp 71951a1
update readme
siriwatknp c7956f4
remove updateTemplatesTheme script
siriwatknp a7753c3
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp b228a99
run pnpm dedupe
siriwatknp bc9e2c2
run pnpm dedupe
siriwatknp 5b6e056
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp d86c497
update theme selector
siriwatknp 61813d9
move size to formcontrol
siriwatknp 4721573
Standardize close button in Drawer
zanivan 77b5d1a
Fix Checkout template Drawer background
zanivan 6e41285
Fix Checkout template padding
zanivan a23c3c2
Fix Dialog background
zanivan 1083b23
Fix Dashboard Drawer
zanivan ad5a8b7
Run docs:typescript:formatted
zanivan 4ad31e4
Standardize close button in Blog's Drawer
zanivan 0e3df7f
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp 184e750
add ColorModeIconDropdown to mobile viewport
siriwatknp 285e66c
run docs:ts
siriwatknp c1865d6
improve sign in-* templates
siriwatknp c2f5e54
run dedupe
siriwatknp 88a6a6e
Merge remote-tracking branch 'upstream/master' into pr/43708
zanivan 170a9c9
Merge branch 'template/new-structure' of https://github.com/siriwatkn…
zanivan 04a0b60
Merge branch 'master' of https://github.com/mui/material-ui into temp…
siriwatknp 883e35a
revert
siriwatknp 5cc855c
hide select root
siriwatknp 97d344c
add TEMPLATE_IMAGE_URL to images in the templates
siriwatknp 55d7dc4
docs ts format
siriwatknp d75ead4
fallback to mui.com
siriwatknp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
69 changes: 15 additions & 54 deletions
69
docs/data/material/getting-started/templates/blog/Blog.js
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 |
---|---|---|
@@ -1,65 +1,26 @@ | ||
import * as React from 'react'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import Container from '@mui/material/Container'; | ||
import { createTheme, ThemeProvider } from '@mui/material/styles'; | ||
import AppAppBar from './components/AppAppBar'; | ||
import MainContent from './components/MainContent'; | ||
import Latest from './components/Latest'; | ||
import Footer from './components/Footer'; | ||
import TemplateFrame from './TemplateFrame'; | ||
|
||
import getBlogTheme from './theme/getBlogTheme'; | ||
|
||
export default function Blog() { | ||
const [mode, setMode] = React.useState('light'); | ||
const [showCustomTheme, setShowCustomTheme] = React.useState(true); | ||
const blogTheme = createTheme(getBlogTheme(mode)); | ||
const defaultTheme = createTheme({ palette: { mode } }); | ||
// This code only runs on the client side, to determine the system color preference | ||
React.useEffect(() => { | ||
// Check if there is a preferred mode in localStorage | ||
const savedMode = localStorage.getItem('themeMode'); | ||
if (savedMode) { | ||
setMode(savedMode); | ||
} else { | ||
// If no preference is found, it uses system preference | ||
const systemPrefersDark = window.matchMedia( | ||
'(prefers-color-scheme: dark)', | ||
).matches; | ||
setMode(systemPrefersDark ? 'dark' : 'light'); | ||
} | ||
}, []); | ||
|
||
const toggleColorMode = () => { | ||
const newMode = mode === 'dark' ? 'light' : 'dark'; | ||
setMode(newMode); | ||
localStorage.setItem('themeMode', newMode); // Save the selected mode to localStorage | ||
}; | ||
|
||
const toggleCustomTheme = () => { | ||
setShowCustomTheme((prev) => !prev); | ||
}; | ||
import AppTheme from '../shared-theme/AppTheme'; | ||
|
||
export default function Blog(props) { | ||
return ( | ||
<TemplateFrame | ||
toggleCustomTheme={toggleCustomTheme} | ||
showCustomTheme={showCustomTheme} | ||
mode={mode} | ||
toggleColorMode={toggleColorMode} | ||
> | ||
<ThemeProvider theme={showCustomTheme ? blogTheme : defaultTheme}> | ||
<CssBaseline enableColorScheme /> | ||
<AppAppBar /> | ||
<Container | ||
maxWidth="lg" | ||
component="main" | ||
sx={{ display: 'flex', flexDirection: 'column', my: 16, gap: 4 }} | ||
> | ||
<MainContent /> | ||
<Latest /> | ||
</Container> | ||
<Footer /> | ||
</ThemeProvider> | ||
</TemplateFrame> | ||
<AppTheme {...props}> | ||
<CssBaseline enableColorScheme /> | ||
<AppAppBar /> | ||
<Container | ||
maxWidth="lg" | ||
component="main" | ||
sx={{ display: 'flex', flexDirection: 'column', my: 16, gap: 4 }} | ||
> | ||
<MainContent /> | ||
<Latest /> | ||
</Container> | ||
<Footer /> | ||
</AppTheme> | ||
); | ||
} |
69 changes: 15 additions & 54 deletions
69
docs/data/material/getting-started/templates/blog/Blog.tsx
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 |
---|---|---|
@@ -1,66 +1,27 @@ | ||
import * as React from 'react'; | ||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import Container from '@mui/material/Container'; | ||
import { createTheme, ThemeProvider, PaletteMode } from '@mui/material/styles'; | ||
import AppAppBar from './components/AppAppBar'; | ||
import MainContent from './components/MainContent'; | ||
import Latest from './components/Latest'; | ||
import Footer from './components/Footer'; | ||
import TemplateFrame from './TemplateFrame'; | ||
|
||
import getBlogTheme from './theme/getBlogTheme'; | ||
|
||
export default function Blog() { | ||
const [mode, setMode] = React.useState<PaletteMode>('light'); | ||
const [showCustomTheme, setShowCustomTheme] = React.useState(true); | ||
const blogTheme = createTheme(getBlogTheme(mode)); | ||
const defaultTheme = createTheme({ palette: { mode } }); | ||
// This code only runs on the client side, to determine the system color preference | ||
React.useEffect(() => { | ||
// Check if there is a preferred mode in localStorage | ||
const savedMode = localStorage.getItem('themeMode') as PaletteMode | null; | ||
if (savedMode) { | ||
setMode(savedMode); | ||
} else { | ||
// If no preference is found, it uses system preference | ||
const systemPrefersDark = window.matchMedia( | ||
'(prefers-color-scheme: dark)', | ||
).matches; | ||
setMode(systemPrefersDark ? 'dark' : 'light'); | ||
} | ||
}, []); | ||
|
||
const toggleColorMode = () => { | ||
const newMode = mode === 'dark' ? 'light' : 'dark'; | ||
setMode(newMode); | ||
localStorage.setItem('themeMode', newMode); // Save the selected mode to localStorage | ||
}; | ||
|
||
const toggleCustomTheme = () => { | ||
setShowCustomTheme((prev) => !prev); | ||
}; | ||
import AppTheme from '../shared-theme/AppTheme'; | ||
|
||
export default function Blog(props: { disableCustomTheme?: boolean }) { | ||
return ( | ||
<TemplateFrame | ||
toggleCustomTheme={toggleCustomTheme} | ||
showCustomTheme={showCustomTheme} | ||
mode={mode} | ||
toggleColorMode={toggleColorMode} | ||
> | ||
<ThemeProvider theme={showCustomTheme ? blogTheme : defaultTheme}> | ||
<CssBaseline enableColorScheme /> | ||
<AppTheme {...props}> | ||
<CssBaseline enableColorScheme /> | ||
|
||
<AppAppBar /> | ||
<Container | ||
maxWidth="lg" | ||
component="main" | ||
sx={{ display: 'flex', flexDirection: 'column', my: 16, gap: 4 }} | ||
> | ||
<MainContent /> | ||
<Latest /> | ||
</Container> | ||
<Footer /> | ||
</ThemeProvider> | ||
</TemplateFrame> | ||
<AppAppBar /> | ||
<Container | ||
maxWidth="lg" | ||
component="main" | ||
sx={{ display: 'flex', flexDirection: 'column', my: 16, gap: 4 }} | ||
> | ||
<MainContent /> | ||
<Latest /> | ||
</Container> | ||
<Footer /> | ||
</AppTheme> | ||
); | ||
} |
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
113 changes: 0 additions & 113 deletions
113
docs/data/material/getting-started/templates/blog/TemplateFrame.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
Off-topic
We could provide a CLI script that does this. Related to #39588
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.
I really dig this! I created a shaping page kind of related to this https://www.notion.so/mui-org/material-ui-Installation-CLI-e32438c1880c466c8b7075d289e825c4 I think it'd be really nice to have the templates as starting point for new projects.