Header.js 2.61 KB
Newer Older
seoyeon's avatar
0705    
seoyeon committed
1
import { Link } from 'react-router-dom'
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
2
3
import { handleLogout } from '../context/auth'

Kim, Chaerin's avatar
Kim, Chaerin committed
4
const Header = () => {
이재연's avatar
이재연 committed
5
  const id = sessionStorage.getItem('user');
Kim, Chaerin's avatar
Kim, Chaerin committed
6
7
  return (
    <div>
8
      <form
seoyeon's avatar
0705    
seoyeon committed
9
        style={{ backgroundColor: '#FCF4FF' }}
10
11
        className="flex-column align-items-center justify-content-center p-2"
      >
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
12
13
        <div className="d-flex justify-content-end">
          <div>
Kim, Chaerin's avatar
Kim, Chaerin committed
14
            <Link to={`/user/${id}`}>
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
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
48
49
50
51
52
53
54
              <img src="/BORA.png" style={{ width: '160px' }} />
            </Link>
          </div>
          <button
            type="button"
            className=" mt-3 ms-5 rounded"
            data-bs-toggle="modal"
            data-bs-target="#logout"
            style={{
              height: '30px',
              backgroundColor: '#E0CEE8',
              color: 'black',
              border: '1px #E0CEE8',
            }}
          >
            로그아웃
          </button>
          <div
            className="modal fade"
            id="logout"
            tabIndex="-1"
            aria-labelledby="logoutLabel"
            aria-hidden="true"
          >
            <div className="modal-dialog">
              <div className="modal-content">
                <div className="modal-header">
                  <button
                    type="button"
                    className="btn-close"
                    data-bs-dismiss="modal"
                    aria-label="Close"
                  ></button>
                </div>
                <div className="modal-body d-flex justify-content-center">
                  로그아웃 하시겠습니까?
                </div>
                <div className="row mb-3">
                  <div className="d-flex justify-content-evenly">
                    <Link to="/" className="col-2 p-1 btn btn-primary">
Kim, Chaerin's avatar
Kim, Chaerin committed
55
56
57
58
59
60
61
62
                      <button
                        type="submit"
                        className="btn btn-primary"
                        onClick={() => handleLogout()}
                        data-bs-dismiss="modal"
                      >
                        
                      </button>
Kim, Chaerin's avatar
merge19    
Kim, Chaerin committed
63
64
65
66
67
68
69
70
71
72
73
74
75
                    </Link>
                    <button
                      type="submit"
                      className="col-2 p-1 btn btn-primary"
                      data-bs-dismiss="modal"
                    >
                      아니요
                    </button>
                  </div>
                </div>
              </div>
            </div>
          </div>
76
77
78
        </div>
      </form>
      <div
seoyeon's avatar
0705    
seoyeon committed
79
        style={{ backgroundColor: '#262626', width: 'auto', height: '2px' }}
80
      ></div>
Kim, Chaerin's avatar
Kim, Chaerin committed
81
    </div>
seoyeon's avatar
0705    
seoyeon committed
82
83
  )
}
Kim, Chaerin's avatar
Kim, Chaerin committed
84

seoyeon's avatar
0705    
seoyeon committed
85
export default Header