-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from design-sparx/feat/multiple-sidebar-variat…
…ions feat: multiple sidebar variations
- Loading branch information
Showing
15 changed files
with
384 additions
and
383 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"mantine-analytics-dashboard": patch | ||
--- | ||
|
||
feat: multiple sidebar variations |
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
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,64 +1,15 @@ | ||
'use client'; | ||
|
||
import { AppShell, Container, rem, useMantineTheme } from '@mantine/core'; | ||
import { ReactNode } from 'react'; | ||
import { useDisclosure, useMediaQuery } from '@mantine/hooks'; | ||
import AppMain from '@/components/AppMain'; | ||
import Navigation from '@/components/Navigation'; | ||
import HeaderNav from '@/components/HeaderNav'; | ||
import FooterNav from '@/components/FooterNav'; | ||
|
||
import { MainLayout } from '@/layout/Main'; | ||
|
||
export type SidebarState = 'hidden' | 'mini' | 'full'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
function AppsLayout({ children }: Props) { | ||
const theme = useMantineTheme(); | ||
const tablet_match = useMediaQuery('(max-width: 768px)'); | ||
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(); | ||
const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true); | ||
|
||
return ( | ||
<AppShell | ||
layout="alt" | ||
header={{ height: 60 }} | ||
footer={{ height: 60 }} | ||
navbar={{ | ||
width: 300, | ||
breakpoint: 'md', | ||
collapsed: { mobile: !mobileOpened, desktop: !desktopOpened }, | ||
}} | ||
padding={0} | ||
> | ||
<AppShell.Header | ||
style={{ | ||
height: rem(60), | ||
border: 'none', | ||
boxShadow: tablet_match ? theme.shadows.md : theme.shadows.sm, | ||
}} | ||
> | ||
<Container fluid py="sm" px="lg"> | ||
<HeaderNav | ||
desktopOpened={desktopOpened} | ||
mobileOpened={mobileOpened} | ||
toggleDesktop={toggleDesktop} | ||
toggleMobile={toggleMobile} | ||
/> | ||
</Container> | ||
</AppShell.Header> | ||
<AppShell.Navbar> | ||
<Navigation onClose={toggleMobile} /> | ||
</AppShell.Navbar> | ||
<AppShell.Main> | ||
<AppMain>{children}</AppMain> | ||
</AppShell.Main> | ||
<AppShell.Footer p="md"> | ||
<Container fluid px="lg"> | ||
<FooterNav /> | ||
</Container> | ||
</AppShell.Footer> | ||
</AppShell> | ||
); | ||
return <MainLayout>{children}</MainLayout>; | ||
} | ||
|
||
export default AppsLayout; |
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,64 +1,13 @@ | ||
'use client'; | ||
import { ReactNode } from 'react'; | ||
|
||
import { AppShell, Container, rem, useMantineTheme } from '@mantine/core'; | ||
import { ReactNode, useState } from 'react'; | ||
import { useDisclosure, useMediaQuery } from '@mantine/hooks'; | ||
import AppMain from '@/components/AppMain'; | ||
import Navigation from '@/components/Navigation'; | ||
import HeaderNav from '@/components/HeaderNav'; | ||
import FooterNav from '@/components/FooterNav'; | ||
import { MainLayout } from '@/layout/Main'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
function DashboardLayout({ children }: Props) { | ||
const theme = useMantineTheme(); | ||
const tablet_match = useMediaQuery('(max-width: 768px)'); | ||
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(); | ||
const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true); | ||
|
||
return ( | ||
<AppShell | ||
layout="alt" | ||
header={{ height: 60 }} | ||
footer={{ height: 60 }} | ||
navbar={{ | ||
width: 300, | ||
breakpoint: 'md', | ||
collapsed: { mobile: !mobileOpened, desktop: !desktopOpened }, | ||
}} | ||
padding={0} | ||
> | ||
<AppShell.Header | ||
style={{ | ||
height: rem(60), | ||
border: 'none', | ||
boxShadow: tablet_match ? theme.shadows.md : theme.shadows.sm, | ||
}} | ||
> | ||
<Container fluid py="sm" px="lg"> | ||
<HeaderNav | ||
desktopOpened={desktopOpened} | ||
mobileOpened={mobileOpened} | ||
toggleDesktop={toggleDesktop} | ||
toggleMobile={toggleMobile} | ||
/> | ||
</Container> | ||
</AppShell.Header> | ||
<AppShell.Navbar> | ||
<Navigation onClose={toggleMobile} /> | ||
</AppShell.Navbar> | ||
<AppShell.Main> | ||
<AppMain>{children}</AppMain> | ||
</AppShell.Main> | ||
<AppShell.Footer p="md"> | ||
<Container fluid px="lg"> | ||
<FooterNav /> | ||
</Container> | ||
</AppShell.Footer> | ||
</AppShell> | ||
); | ||
return <MainLayout>{children}</MainLayout>; | ||
} | ||
|
||
export default DashboardLayout; |
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
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,64 +1,13 @@ | ||
'use client'; | ||
import { ReactNode } from 'react'; | ||
|
||
import { AppShell, Container, rem, useMantineTheme } from '@mantine/core'; | ||
import { ReactNode, useState } from 'react'; | ||
import { useDisclosure, useMediaQuery } from '@mantine/hooks'; | ||
import AppMain from '@/components/AppMain'; | ||
import Navigation from '@/components/Navigation'; | ||
import HeaderNav from '@/components/HeaderNav'; | ||
import FooterNav from '@/components/FooterNav'; | ||
import { MainLayout } from '@/layout/Main'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
function PagesLayout({ children }: Props) { | ||
const theme = useMantineTheme(); | ||
const tablet_match = useMediaQuery('(max-width: 768px)'); | ||
const [mobileOpened, { toggle: toggleMobile }] = useDisclosure(); | ||
const [desktopOpened, { toggle: toggleDesktop }] = useDisclosure(true); | ||
|
||
return ( | ||
<AppShell | ||
layout="alt" | ||
header={{ height: 60 }} | ||
footer={{ height: 60 }} | ||
navbar={{ | ||
width: 300, | ||
breakpoint: 'md', | ||
collapsed: { mobile: !mobileOpened, desktop: !desktopOpened }, | ||
}} | ||
padding={0} | ||
> | ||
<AppShell.Header | ||
style={{ | ||
height: rem(60), | ||
border: 'none', | ||
boxShadow: tablet_match ? theme.shadows.md : theme.shadows.sm, | ||
}} | ||
> | ||
<Container fluid py="sm" px="lg"> | ||
<HeaderNav | ||
desktopOpened={desktopOpened} | ||
mobileOpened={mobileOpened} | ||
toggleDesktop={toggleDesktop} | ||
toggleMobile={toggleMobile} | ||
/> | ||
</Container> | ||
</AppShell.Header> | ||
<AppShell.Navbar> | ||
<Navigation onClose={toggleMobile} /> | ||
</AppShell.Navbar> | ||
<AppShell.Main> | ||
<AppMain>{children}</AppMain> | ||
</AppShell.Main> | ||
<AppShell.Footer p="md"> | ||
<Container fluid px="lg"> | ||
<FooterNav /> | ||
</Container> | ||
</AppShell.Footer> | ||
</AppShell> | ||
); | ||
return <MainLayout>{children}</MainLayout>; | ||
} | ||
|
||
export default PagesLayout; |
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
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
Oops, something went wrong.