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

[Template] Add iOS theme to Joy UI #34994

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export default function TemplateCollection() {
<NextLink
href={`/joy-ui/getting-started/templates/${name}/`}
passHref
legacyBehavior
>
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
<Link
Expand Down
88 changes: 88 additions & 0 deletions docs/data/joy/getting-started/templates/ios/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import * as React from 'react';
import { CssVarsProvider, useTheme } from '@mui/joy/styles';
import Box from '@mui/joy/Box';
import CssBaseline from '@mui/joy/CssBaseline';

import Header from './Header';
import Navigation, { NavigationView } from './Navigation';
import ColorSystem from './ColorSystem';
import TypographySystem from './TypographySystem';
import iosTheme from './theme';
import Bars from './Bars';

function SystemMaterials() {
const theme = useTheme();
return (
<Box
sx={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(300px, 1fr))',
gridAutoRows: '240px',
gap: 2,
}}
>
{(Object.keys(theme.materials) as Array<keyof typeof theme.materials>).map(
(material) => (
<Box key={material} sx={{ p: 5 }}>
<Box
sx={{
borderRadius: 'sm',
height: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
material,
}}
>
{material}
</Box>
</Box>
),
)}
</Box>
);
}

export default function IosExample() {
// const [disableTheme, setDisableTheme] = React.useState(false);
const [view, setView] = React.useState<NavigationView>('bars');
return (
<CssVarsProvider
defaultMode="system"
disableTransitionOnChange
// theme={disableTheme ? undefined : iosTheme}
theme={iosTheme}
>
<CssBaseline />
<Box
sx={{
'--header-height': '44px',
minHeight:
'calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom))',
display: 'grid',
gridTemplateColumns: 'auto 1fr',
gridTemplateRows: 'var(--header-height) 1fr',
gridTemplateAreas: '"header header" "nav main"',
}}
>
<Header />
<Navigation value={view} onItemClick={(value) => setView(value)} />
<Box
component="main"
sx={{
p: '0.5rem',
gridArea: 'main',
pr: 'calc(0.5rem + env(safe-area-inset-right))',
pb: 'calc(2rem + env(safe-area-inset-bottom))',
}}
>
{view === 'bars' && <Bars />}
{view === 'color' && <ColorSystem />}
{view === 'text' && <TypographySystem />}
{view === 'material' && <SystemMaterials />}
</Box>
</Box>
</CssVarsProvider>
);
}
Loading