-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHeader.tsx
More file actions
43 lines (38 loc) · 1.02 KB
/
Header.tsx
File metadata and controls
43 lines (38 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
37
38
39
40
41
42
43
import { ReactNode } from "react";
import { useLocation } from "react-router-dom";
import SubHeader from "@/components/header/SubHeader";
import MainHeader from "@/components/header/MainHeader";
import useAuthStore from "@/store/useAuthStore";
type HeaderProps = {
title?: string;
showPreviousIcon?: boolean;
showShareIcon?: boolean;
children?: ReactNode;
};
const Header = ({
title = "",
showPreviousIcon = true,
showShareIcon = true,
children
}: HeaderProps) => {
const { pathname } = useLocation();
const { isLoggedIn } = useAuthStore();
const isHomepage = pathname === "/";
return (
<>
<div className="fixed z-50 w-[360px] bg-white md:w-[375px] lg:w-[500px]">
{isHomepage ? (
<MainHeader isLoggedIn={isLoggedIn} />
) : (
<SubHeader
title={title}
showPreviousIcon={showPreviousIcon}
showShareIcon={showShareIcon}
/>
)}
</div>
<div className="pt-14">{children}</div>
</>
);
};
export default Header;