ADD user prop to Sidebar and conditionally render My Clips button
This commit is contained in:
@@ -2,12 +2,14 @@ import clsx from "clsx";
|
|||||||
import SidebarButton from "./buttons/SidebarButton.tsx";
|
import SidebarButton from "./buttons/SidebarButton.tsx";
|
||||||
import { Plus, Film, Home } from 'lucide-react';
|
import { Plus, Film, Home } from 'lucide-react';
|
||||||
import Box from "./Box.tsx";
|
import Box from "./Box.tsx";
|
||||||
|
import type {User} from "../utils/types.ts";
|
||||||
|
|
||||||
type props = {
|
type props = {
|
||||||
|
user: User | null;
|
||||||
className?: string
|
className?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const Sidebar = ({className}: props) => {
|
const Sidebar = ({user, className}: props) => {
|
||||||
return (
|
return (
|
||||||
<Box className={clsx("h-screen flex flex-col mr-5", className)}>
|
<Box className={clsx("h-screen flex flex-col mr-5", className)}>
|
||||||
<img
|
<img
|
||||||
@@ -27,11 +29,13 @@ const Sidebar = ({className}: props) => {
|
|||||||
label={"Create Clip"}
|
label={"Create Clip"}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SidebarButton
|
{ user && (
|
||||||
url={"/my-clips"}
|
<SidebarButton
|
||||||
logo={<Film size={20}/>}
|
url={"/my-clips"}
|
||||||
label={"My Clips"}
|
logo={<Film size={20}/>}
|
||||||
/>
|
label={"My Clips"}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const MainLayout = () => {
|
|||||||
return (
|
return (
|
||||||
<div className={`transition-all duration-300 grid h-screen ${sidebarToggled ? "grid-cols-[0px_1fr]" : "grid-cols-[240px_1fr]"} grid-rows-[auto_1fr]`}>
|
<div className={`transition-all duration-300 grid h-screen ${sidebarToggled ? "grid-cols-[0px_1fr]" : "grid-cols-[240px_1fr]"} grid-rows-[auto_1fr]`}>
|
||||||
<Sidebar
|
<Sidebar
|
||||||
|
user={user}
|
||||||
className={`row-span-2 transition-all duration-300 overflow-hidden whitespace-nowrap ${sidebarToggled ? "-translate-x-full" : "translate-x-0"}`}/>
|
className={`row-span-2 transition-all duration-300 overflow-hidden whitespace-nowrap ${sidebarToggled ? "-translate-x-full" : "translate-x-0"}`}/>
|
||||||
<Topbar
|
<Topbar
|
||||||
className="transition-all duration-300"
|
className="transition-all duration-300"
|
||||||
|
|||||||
Reference in New Issue
Block a user