-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
Copy pathPageHeader.tsx
47 lines (44 loc) · 1.15 KB
/
PageHeader.tsx
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
38
39
40
41
42
43
44
45
46
47
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { fontSize } from "../util";
export interface PageHeaderProps {
onTitleClick?: () => void;
title?: string;
rightContent?: React.ReactNode;
showBorder?: boolean;
}
export function PageHeader({
onTitleClick,
title,
rightContent,
showBorder,
}: PageHeaderProps) {
return (
<div
className={`bg-vsc-background sticky top-0 z-20 m-0 flex items-center justify-between bg-inherit ${
showBorder
? "border-0 border-b-[1px] border-solid border-b-zinc-700"
: ""
}`}
>
{title ? (
<div
className="flex cursor-pointer items-center transition-colors duration-200 hover:text-zinc-100"
onClick={onTitleClick}
>
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3" />
<span
className="mx-2 inline-block text-base font-bold"
style={{
fontSize: fontSize(-2),
}}
>
{title}
</span>
</div>
) : (
<div />
)}
{rightContent && <div className="pr-2">{rightContent}</div>}
</div>
);
}