File size: 746 Bytes
a8dfd23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Button } from "antd";
import AuthModal, { authModalAtom, authStateAtom } from "@/components/auth-modal";
import { useAtomValue, useSetAtom } from "jotai";
import { UserOutlined } from "@ant-design/icons";

const Header = () => {
  const authState = useAtomValue(authStateAtom);
  const setModalOpen = useSetAtom(authModalAtom);
  const isSignedIn = authState === "SIGNED_IN";

  return (
    <>
      <header className="flex justify-between items-center mx-auto py-2">
        <div />
        {isSignedIn ? (
          <UserOutlined className="h-[32px] text-xl" />
        ) : (
          <Button onClick={() => setModalOpen(true)}>Open Auth</Button>
        )}
      </header>
      <AuthModal />
    </>
  );
};

export default Header;