Feat: auth 관련페이지 header 적용
This commit is contained in:
29
features/home/components/spline-scene.tsx
Normal file
29
features/home/components/spline-scene.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
"use client";
|
||||
|
||||
import Spline from "@splinetool/react-spline";
|
||||
import { useState } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface SplineSceneProps {
|
||||
sceneUrl: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function SplineScene({ sceneUrl, className }: SplineSceneProps) {
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
return (
|
||||
<div className={cn("relative h-full w-full", className)}>
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-zinc-100 dark:bg-zinc-900">
|
||||
<div className="h-10 w-10 animate-spin rounded-full border-4 border-zinc-200 border-t-indigo-500 dark:border-zinc-800" />
|
||||
</div>
|
||||
)}
|
||||
<Spline
|
||||
scene={sceneUrl}
|
||||
onLoad={() => setIsLoading(false)}
|
||||
className="h-full w-full"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,33 +1,44 @@
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import Link from "next/link";
|
||||
import { UserMenu } from "./user-menu";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { User } from "@supabase/supabase-js";
|
||||
import { AUTH_ROUTES } from "@/features/auth/constants";
|
||||
import { UserMenu } from "@/features/layout/components/user-menu";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export async function Header() {
|
||||
const supabase = await createClient();
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
interface HeaderProps {
|
||||
user: User | null;
|
||||
showDashboardLink?: boolean;
|
||||
}
|
||||
|
||||
export function Header({ user, showDashboardLink = false }: HeaderProps) {
|
||||
return (
|
||||
<header className="sticky top-0 z-40 flex h-14 w-full items-center justify-between border-b border-zinc-200 bg-white/75 px-6 backdrop-blur-md transition-all dark:border-zinc-800 dark:bg-black/75">
|
||||
<div className="flex items-center gap-2">
|
||||
<Link href={AUTH_ROUTES.DASHBOARD} className="flex items-center gap-2">
|
||||
<Link href={AUTH_ROUTES.HOME} className="flex items-center gap-2">
|
||||
<div className="h-6 w-6 rounded-md bg-zinc-900 dark:bg-zinc-50" />
|
||||
<span className="text-lg font-bold tracking-tight text-zinc-900 dark:text-zinc-50">
|
||||
AutoTrade
|
||||
</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
{user ? (
|
||||
<UserMenu user={user} />
|
||||
<>
|
||||
{showDashboardLink && (
|
||||
<Button asChild variant="ghost" size="sm">
|
||||
<Link href={AUTH_ROUTES.DASHBOARD}>대시보드</Link>
|
||||
</Button>
|
||||
)}
|
||||
<UserMenu user={user} />
|
||||
</>
|
||||
) : (
|
||||
<Button asChild variant="default" size="sm">
|
||||
<Link href={AUTH_ROUTES.LOGIN}>로그인</Link>
|
||||
</Button>
|
||||
<>
|
||||
<Button asChild variant="ghost" size="sm">
|
||||
<Link href={AUTH_ROUTES.LOGIN}>로그인</Link>
|
||||
</Button>
|
||||
<Button asChild size="sm">
|
||||
<Link href={AUTH_ROUTES.SIGNUP}>무료로 시작하기</Link>
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user