-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Tasks layout for switching view mode
- Loading branch information
1 parent
bccb653
commit 6aa70e0
Showing
4 changed files
with
63 additions
and
3 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
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,57 @@ | ||
'use client' | ||
|
||
import { PropsWithChildren } from 'react' | ||
import { Tabs, TabList, Tab, Box, Divider } from '@mui/joy' | ||
import Link from 'next/link' | ||
import { usePathname } from 'next/navigation' | ||
|
||
export default function TasksLayout({ children }: PropsWithChildren) { | ||
const pathname = usePathname() | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
display: 'grid', | ||
padding: { xs: '0 8px', sm: '0' }, | ||
margin: '0 auto', | ||
maxWidth: '1146px', | ||
rowGap: '16px' | ||
}} | ||
> | ||
<Tabs | ||
sx={{ | ||
borderRadius: '8px', | ||
border: '1px solid #C4C6D0', | ||
width: 'fit-content', | ||
paddding: '1px' | ||
}} | ||
size="md" | ||
value={pathname} | ||
> | ||
<TabList disableUnderline> | ||
<TimeViewTab path="/tasks">Day</TimeViewTab> | ||
<TimeViewTab path="/tasks/week">Week</TimeViewTab> | ||
<TimeViewTab path="/tasks/month">Month</TimeViewTab> | ||
</TabList> | ||
</Tabs> | ||
<Divider /> | ||
{children} | ||
</Box> | ||
) | ||
} | ||
|
||
const TimeViewTab = ({ children, path }: PropsWithChildren<{ path: string }>) => { | ||
return ( | ||
<Link href={path}> | ||
<Tab | ||
sx={{ borderRadius: '7px' }} | ||
value={path} | ||
variant="plain" | ||
color="primary" | ||
disableIndicator | ||
> | ||
{children} | ||
</Tab> | ||
</Link> | ||
) | ||
} |
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,3 @@ | ||
export default function MonthView() { | ||
return <div>Month!</div> | ||
} |
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,3 @@ | ||
export default async function WeekView() { | ||
return <div>Week!</div> | ||
} |