user button ui

This commit is contained in:
Ishaan Dey 2024-04-18 15:07:15 -04:00
parent 5045c4ce9a
commit 5dc337e2ff
6 changed files with 42 additions and 19 deletions

View File

@ -20,7 +20,7 @@ export default async function DashboardPage() {
return ( return (
<div className="w-screen h-screen flex flex-col overflow-hidden overscroll-none"> <div className="w-screen h-screen flex flex-col overflow-hidden overscroll-none">
<Navbar /> <Navbar userId={user.id} />
<Dashboard sandboxes={data} /> <Dashboard sandboxes={data} />
</div> </div>
) )

View File

@ -57,7 +57,7 @@
--accent: 0 0% 14.9%; --accent: 0 0% 14.9%;
--accent-foreground: 0 0% 98%; --accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 50%; --destructive: 0 62.8% 60%;
--destructive-foreground: 0 0% 98%; --destructive-foreground: 0 0% 98%;
--border: 0 0% 14.9%; --border: 0 0% 14.9%;

View File

@ -1,17 +1,12 @@
"use client"
import { UserButton } from "@clerk/nextjs" import { UserButton } from "@clerk/nextjs"
import { dark } from "@clerk/themes" import { dark } from "@clerk/themes"
import Image from "next/image" import Image from "next/image"
import Link from "next/link" import Link from "next/link"
import Logo from "@/assets/logo.svg" import Logo from "@/assets/logo.svg"
import { Input } from "../../ui/input"
import { Search } from "lucide-react"
import { Suspense, useCallback, useEffect, useState } from "react"
import { useRouter, useSearchParams } from "next/navigation"
import DashboardNavbarSearch from "./search" import DashboardNavbarSearch from "./search"
import DashboardUserButton from "./userButton"
export default function DashboardNavbar() { export default function DashboardNavbar({ userId }: { userId: string }) {
return ( return (
<div className="h-16 px-4 w-full flex items-center justify-between border-b border-border"> <div className="h-16 px-4 w-full flex items-center justify-between border-b border-border">
<div className="flex items-center space-x-4"> <div className="flex items-center space-x-4">
@ -25,12 +20,7 @@ export default function DashboardNavbar() {
</div> </div>
<div className="flex items-center space-x-4"> <div className="flex items-center space-x-4">
<DashboardNavbarSearch /> <DashboardNavbarSearch />
<UserButton <DashboardUserButton userId={userId} />
appearance={{
baseTheme: dark,
}}
afterSignOutUrl="/"
/>
</div> </div>
</div> </div>
) )

View File

@ -2,8 +2,8 @@
import { Input } from "../../ui/input" import { Input } from "../../ui/input"
import { Search } from "lucide-react" import { Search } from "lucide-react"
import { useCallback, useEffect, useState } from "react" import { useEffect, useState } from "react"
import { useRouter, useSearchParams } from "next/navigation" import { useRouter } from "next/navigation"
export default function DashboardNavbarSearch() { export default function DashboardNavbarSearch() {
const [search, setSearch] = useState("") const [search, setSearch] = useState("")

View File

@ -0,0 +1,32 @@
"use client"
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { LogOut, Pencil } from "lucide-react"
export default function DashboardUserButton({ userId }: { userId: string }) {
return (
<DropdownMenu>
<DropdownMenuTrigger>
<div className="w-9 h-9 rounded-full overflow-hidden bg-red-500"></div>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem className="cursor-pointer">
<Pencil className="mr-2 h-4 w-4" />
<span>Edit Profile</span>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem className="!text-destructive cursor-pointer">
<LogOut className="mr-2 h-4 w-4" />
<span>Log Out</span>
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
)
}

View File

@ -25,11 +25,12 @@ export default function ProjectCardDropdown({ sandbox }: { sandbox: Sandbox }) {
<Ellipsis className="w-4 h-4" /> <Ellipsis className="w-4 h-4" />
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent className="w-40"> <DropdownMenuContent className="w-40">
<DropdownMenuItem> <DropdownMenuItem className="cursor-pointer">
<Lock className="mr-2 h-4 w-4" /> <Lock className="mr-2 h-4 w-4" />
<span>Make Private</span> <span>Make Private</span>
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem className="!text-destructive"> <DropdownMenuSeparator />
<DropdownMenuItem className="!text-destructive cursor-pointer">
<Trash2 className="mr-2 h-4 w-4" /> <Trash2 className="mr-2 h-4 w-4" />
<span>Delete Project</span> <span>Delete Project</span>
</DropdownMenuItem> </DropdownMenuItem>