-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
475 additions
and
33 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 |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import { Footer } from "@/components/footer"; | ||
import { Navbar } from "@/components/navbar"; | ||
import { SidebarWrapper } from "@/components/sidebar/sidebar"; | ||
import { auth } from "@/lib/auth"; | ||
|
||
export default async function AuthLayout(props: { | ||
user: React.ReactNode; | ||
admin: React.ReactNode; | ||
}) { | ||
const session = await auth(); | ||
const isAdmin = session?.user.role === "admin"; | ||
|
||
return ( | ||
<> | ||
<Navbar /> | ||
<main className="container flex min-h-[calc(100vh-8rem)]"> | ||
{session?.user.role === "admin" ? props.admin : props.user} | ||
</main> | ||
<Footer /> | ||
</> | ||
<div className="flex flex-row"> | ||
{session?.user.role === "admin" && <SidebarWrapper />} | ||
<div className="flex-1"> | ||
<Navbar /> | ||
<main className="container flex min-h-[calc(100vh-8rem)]"> | ||
{isAdmin ? props.admin : props.user} | ||
</main> | ||
<Footer /> | ||
</div> | ||
</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
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
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,137 @@ | ||
"use client"; | ||
|
||
import { IoChevronUp } from "react-icons/io5"; | ||
|
||
import { Accordion, AccordionItem } from "@tanya.in/ui/accordion"; | ||
|
||
interface Props { | ||
icon: React.ReactNode; | ||
title: string; | ||
items: string[]; | ||
} | ||
|
||
export const CollapseItems = ({ icon, items, title }: Props) => { | ||
return ( | ||
<div className="flex h-full cursor-pointer items-center gap-4"> | ||
<Accordion className="px-0"> | ||
<AccordionItem | ||
indicator={<IoChevronUp />} | ||
classNames={{ | ||
indicator: "data-[open=true]:-rotate-180", | ||
trigger: | ||
"py-0 min-h-[44px] hover:bg-default-100 rounded-xl active:scale-[0.98] transition-transform px-3.5", | ||
|
||
title: | ||
"px-0 flex text-base gap-2 h-full items-center cursor-pointer", | ||
}} | ||
aria-label="Accordion 1" | ||
title={ | ||
<div className="flex flex-row gap-2"> | ||
<span>{icon}</span> | ||
<span>{title}</span> | ||
</div> | ||
} | ||
> | ||
<div className="pl-12"> | ||
{items.map((item, index) => ( | ||
<span | ||
key={index} | ||
className="flex w-full text-default-500 transition-colors hover:text-default-900" | ||
> | ||
{item} | ||
</span> | ||
))} | ||
</div> | ||
</AccordionItem> | ||
</Accordion> | ||
{/* <Accordion | ||
title={ | ||
<div | ||
className="flex items-center justify-between w-full py-5 px-7 rounded-8 transition-all duration-150 ease-in-out cursor-pointer hover:bg-accents2 active:scale-98" | ||
// css={{ | ||
// gap: "$6", | ||
// width: "100%", | ||
// py: "$5", | ||
// px: "$7", | ||
// borderRadius: "8px", | ||
// transition: "all 0.15s ease", | ||
// "&:active": { | ||
// transform: "scale(0.98)", | ||
// }, | ||
// "&:hover": { | ||
// bg: "$accents2", | ||
// }, | ||
// }} | ||
// justify={"between"} | ||
onClick={handleToggle} | ||
> | ||
<div className="flex gap-4"> | ||
{icon} | ||
<span | ||
className="text-default-900 font-medium text-base" | ||
// span | ||
// weight={"normal"} | ||
// size={"$base"} | ||
// css={{ | ||
// color: "$accents9", | ||
// }} | ||
> | ||
{title} | ||
</span> | ||
</div> | ||
<ChevronUpIcon | ||
className={clsx( | ||
open ? "rotate-180" : "rotate-0", | ||
"transition-all duration-300 ease-in-out transform" | ||
)} | ||
// css={{ | ||
// transition: "transform 0.3s ease", | ||
// transform: open ? "rotate(-180deg)" : "rotate(0deg)", | ||
// }} | ||
/> | ||
</div> | ||
} | ||
// css={{ | ||
// width: "100%", | ||
// "& .nextui-collapse-view": { | ||
// p: "0", | ||
// }, | ||
// "& .nextui-collapse-content": { | ||
// marginTop: "$1", | ||
// padding: "0px", | ||
// }, | ||
// }} | ||
divider={false} | ||
showArrow={false} | ||
> | ||
{items.map((item, index) => ( | ||
<div | ||
className="flex flex-col pl-8" | ||
key={index} | ||
// direction={"column"} | ||
// css={{ | ||
// paddingLeft: "$16", | ||
// }} | ||
> | ||
<span | ||
className="text-default-400 font-normal text-md" | ||
// span | ||
// weight={"normal"} | ||
// size={"$md"} | ||
// css={{ | ||
// color: "$accents8", | ||
// cursor: "pointer", | ||
// "&:hover": { | ||
// color: "$accents9", | ||
// }, | ||
// }} | ||
> | ||
{item} | ||
</span> | ||
</div> | ||
))} | ||
</Accordion> */} | ||
</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,27 @@ | ||
"use client"; | ||
|
||
import { useSession } from "next-auth/react"; | ||
import { IoMenu } from "react-icons/io5"; | ||
|
||
import { Button } from "@tanya.in/ui/button"; | ||
|
||
import { useSidebarContext } from "./sidebar-context"; | ||
|
||
export const SidebarButton = () => { | ||
const { setCollapsed } = useSidebarContext(); | ||
const { data: session } = useSession(); | ||
|
||
return ( | ||
session?.user.role === "admin" && ( | ||
<Button | ||
isIconOnly | ||
variant="light" | ||
aria-label="Menu" | ||
onClick={setCollapsed} | ||
className="md:hidden" | ||
> | ||
<IoMenu size={28} /> | ||
</Button> | ||
) | ||
); | ||
}; |
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,14 @@ | ||
import { createContext, useContext } from "react"; | ||
|
||
interface SidebarContext { | ||
collapsed: boolean; | ||
setCollapsed?: () => void; | ||
} | ||
|
||
export const SidebarContext = createContext<SidebarContext>({ | ||
collapsed: false, | ||
}); | ||
|
||
export const useSidebarContext = () => { | ||
return useContext(SidebarContext); | ||
}; |
Oops, something went wrong.