-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[material-ui] Replace the Album template with a landing page (#37557)
Co-authored-by: Diego Andai <diego@mui.com> Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com> Co-authored-by: siriwatknp <siriwatkunaporn@gmail.com>
- Loading branch information
1 parent
154920c
commit 0766bde
Showing
42 changed files
with
4,650 additions
and
296 deletions.
There are no files selected for viewing
137 changes: 0 additions & 137 deletions
137
docs/data/material/getting-started/templates/album/Album.js
This file was deleted.
Oops, something went wrong.
137 changes: 0 additions & 137 deletions
137
docs/data/material/getting-started/templates/album/Album.tsx
This file was deleted.
Oops, something went wrong.
108 changes: 108 additions & 0 deletions
108
docs/data/material/getting-started/templates/landing-page/LandingPage.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 |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import CssBaseline from '@mui/material/CssBaseline'; | ||
import Box from '@mui/material/Box'; | ||
import Divider from '@mui/material/Divider'; | ||
import { ThemeProvider, createTheme } from '@mui/material/styles'; | ||
import ToggleButton from '@mui/material/ToggleButton'; | ||
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup'; | ||
import AutoAwesomeRoundedIcon from '@mui/icons-material/AutoAwesomeRounded'; | ||
import SvgMaterialDesign from 'docs/src/icons/SvgMaterialDesign'; | ||
import AppAppBar from './components/AppAppBar'; | ||
import Hero from './components/Hero'; | ||
import LogoCollection from './components/LogoCollection'; | ||
import Highlights from './components/Highlights'; | ||
import Pricing from './components/Pricing'; | ||
import Features from './components/Features'; | ||
import Testimonials from './components/Testimonials'; | ||
import FAQ from './components/FAQ'; | ||
import Footer from './components/Footer'; | ||
import getLPTheme from './getLPTheme'; | ||
|
||
const defaultTheme = createTheme({}); | ||
|
||
function ToggleCustomTheme({ showCustomTheme, toggleCustomTheme }) { | ||
return ( | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
width: '100dvw', | ||
position: 'fixed', | ||
bottom: 24, | ||
}} | ||
> | ||
<ToggleButtonGroup | ||
color="primary" | ||
exclusive | ||
value={showCustomTheme} | ||
onChange={toggleCustomTheme} | ||
aria-label="Platform" | ||
sx={{ | ||
backgroundColor: 'background.default', | ||
'& .Mui-selected': { | ||
pointerEvents: 'none', | ||
}, | ||
}} | ||
> | ||
<ToggleButton value> | ||
<AutoAwesomeRoundedIcon sx={{ fontSize: '20px', mr: 1 }} /> | ||
Custom theme | ||
</ToggleButton> | ||
<ToggleButton value={false}> | ||
<SvgMaterialDesign sx={{ fontSize: '20px', mr: 1 }} /> | ||
Material Design | ||
</ToggleButton> | ||
</ToggleButtonGroup> | ||
</Box> | ||
); | ||
} | ||
|
||
ToggleCustomTheme.propTypes = { | ||
showCustomTheme: PropTypes.shape({ | ||
valueOf: PropTypes.func.isRequired, | ||
}).isRequired, | ||
toggleCustomTheme: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default function LandingPage() { | ||
const [mode, setMode] = React.useState('dark'); | ||
const [showCustomTheme, setShowCustomTheme] = React.useState(true); | ||
const LPtheme = createTheme(getLPTheme(mode)); | ||
|
||
const toggleColorMode = () => { | ||
setMode((prev) => (prev === 'dark' ? 'light' : 'dark')); | ||
}; | ||
|
||
const toggleCustomTheme = () => { | ||
setShowCustomTheme((prev) => !prev); | ||
}; | ||
|
||
return ( | ||
<ThemeProvider theme={showCustomTheme ? LPtheme : defaultTheme}> | ||
<CssBaseline /> | ||
<AppAppBar mode={mode} toggleColorMode={toggleColorMode} /> | ||
<Hero /> | ||
<Box sx={{ bgcolor: 'background.default' }}> | ||
<LogoCollection /> | ||
<Features /> | ||
<Divider /> | ||
<Testimonials /> | ||
<Divider /> | ||
<Highlights /> | ||
<Divider /> | ||
<Pricing /> | ||
<Divider /> | ||
<FAQ /> | ||
<Divider /> | ||
<Footer /> | ||
</Box> | ||
<ToggleCustomTheme | ||
showCustomTheme={showCustomTheme} | ||
toggleCustomTheme={toggleCustomTheme} | ||
/> | ||
</ThemeProvider> | ||
); | ||
} |
Oops, something went wrong.