aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/components/ProfileDrawer.tsx
blob: 6a617d2a1dbc65a11d903421934511fc666d9632 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { useRef, useState } from "react";
import { Drawer, DrawerContent, DrawerOverlay, DrawerTrigger } from "./ui/drawer";
import { cn } from "@/lib/utils";
import { ProfileTab } from "./Sidebar";
import { useSession } from "next-auth/react";

export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> {
  hide?: boolean;
}

export function ProfileDrawer({ className, hide = false, ...props }: Props) {

	const { data: session } = useSession();
	
  return (
    <Drawer
			snapPoints={[0.9]}
      shouldScaleBackground={false}
    >
			<DrawerTrigger>
				<img src={session?.user?.image ?? "/icons/white_without_bg.png"} className="w-10 h-10 rounded-full" />
			</DrawerTrigger>
      <DrawerContent
        overlay={false}
        className={cn(
          "border-rgray-6 z-[101] bg-rgray-3 DrawerContent data-[expanded=true]:bg-rgray-3 h-full w-screen border transition-[background] focus-visible:outline-none",
          hide ? "hidden" : "",
        )}
      >
				<div className="w-full h-[85vh] overflow-y-auto">
					<ProfileTab open={true} />
				</div>
      </DrawerContent>
    </Drawer>
  );
}