-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsub-header.tsx
More file actions
36 lines (28 loc) · 1.02 KB
/
sub-header.tsx
File metadata and controls
36 lines (28 loc) · 1.02 KB
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
"use client";
import type { ComponentProps, ReactNode } from "react";
import { useRouter } from "next/navigation";
import { ChevronLeft } from "lucide-react";
import { cn } from "@/shared/lib/utils/utils";
import Button from "@/shared/ui/button/button";
interface SubHeaderProps extends Omit<ComponentProps<"header">, "children" | "content"> {
content?: ReactNode;
}
export function SubHeader({ content = "", className, ...props }: SubHeaderProps) {
const router = useRouter();
return (
<header className={cn("w-full lg:hidden", className)} {...props}>
<div className="h-header flex items-center gap-3 px-2.5">
<Button variant="ghost" size="icon-lg" aria-label="뒤로가기" onClick={() => router.back()}>
<ChevronLeft />
</Button>
<div className="flex flex-1 items-center">
{typeof content === "string" ? (
<h1 className="truncate font-semibold">{content}</h1>
) : (
content
)}
</div>
</div>
</header>
);
}