header.tsx 1.78 KB
Newer Older
Kim, MinGyu's avatar
Kim, MinGyu committed
1
import React, { useReducer, useState } from "react";
2
3
import { Link, Outlet } from "react-router-dom";
import { useAuth } from "../auth/auth.context";
백승민's avatar
theme1    
백승민 committed
4
5
6
7

import "tailwindcss/tailwind.css";

export default function Header() {
8
9
10
  const { logout } = useAuth();
  return (
    <div className="flex flex-col ">
Kim, MinGyu's avatar
Kim, MinGyu committed
11
12
      <div className="flex py-10 ">
        <button className="shrink-0  mx-5">
13
14
15
16
          <Link to="/" className="hover:bg-gray-200 focus:text-purple-500">
            Travel Report
          </Link>
        </button>
Kim, MinGyu's avatar
Kim, MinGyu committed
17

Kim, MinGyu's avatar
Kim, MinGyu committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
        <input
          className="md:ml-20 placeholder:text-white focus:outline-none focus:border-y-4 focus:border-l-4 focus:border-sky-500 md:placeholder:text-slate-400 w-20 md:w-1/2 border-y-4 border-l-4 border-sky-500 pl-9 rounded-l-full focus:border-0"
          placeholder="어디로 여행가고 싶나요?"
        />
        <button className="shrink-0 border-y-4  border-r-4 border-sky-500 rounded-r-full pr-4">
          검색
        </button>

        <div className="shrink-0 p-3 md:ml-52 border-r-2 h-12">
          {useAuth().user.isLoggedIn ? (
            <button
              onClick={() => {
                logout();
              }}
32
            >
Kim, MinGyu's avatar
Kim, MinGyu committed
33
34
35
36
37
38
39
40
41
42
43
44
              로그아웃
            </button>
          ) : (
            <button className="shrink-0 bg-white ">
              <Link
                className="hover:bg-purple-300 focus:text-purple-500"
                to="/login"
              >
                로그인
              </Link>
            </button>
          )}
백승민's avatar
theme1    
백승민 committed
45
        </div>
Kim, MinGyu's avatar
Kim, MinGyu committed
46
47
48
49
50
51
52
53
        <button className="shrink-0 p-3 bg-white ">
          <Link
            to="/board"
            className="hover:bg-purple-300 focus:text-purple-500"
          >
            게시판
          </Link>
        </button>
백승민's avatar
theme1    
백승민 committed
54
      </div>
Kim, MinGyu's avatar
Kim, MinGyu committed
55

56
57
58
59
      <Outlet />
    </div>
  );
}