|
@@ -1,20 +1,39 @@
|
|
|
-import React from 'react';
|
|
|
+import React, { useState } from 'react';
|
|
|
+import { connect } from 'react-redux';
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
+import Logout from '../Components/Logout/Logout';
|
|
|
import './header.css';
|
|
|
|
|
|
-function Header() {
|
|
|
- return(
|
|
|
+function Header({ loginName = "", isLogin = false }) {
|
|
|
+
|
|
|
+ let [k, setK] = useState(false)
|
|
|
+
|
|
|
+ return (
|
|
|
<nav>
|
|
|
<header className='header'>
|
|
|
- {/* <img src="Bruce_Willis01.jpg" /> */}
|
|
|
<img src="logo.png" />
|
|
|
|
|
|
- <NavLink to="/login">
|
|
|
- Login Pocu46 ^
|
|
|
- </NavLink>
|
|
|
+ {!isLogin &&
|
|
|
+ <NavLink to="/login">
|
|
|
+ Login
|
|
|
+ </NavLink>
|
|
|
+ }
|
|
|
+
|
|
|
+ {isLogin &&
|
|
|
+ <div onClick={() => setK((x) => !x)}>
|
|
|
+ {loginName}
|
|
|
+ </div>
|
|
|
+ }
|
|
|
+
|
|
|
+ {k && <Logout />}
|
|
|
</header>
|
|
|
</nav>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
-export default Header;
|
|
|
+const CHeader = connect((s) => ({
|
|
|
+ loginName: s.auth.login,
|
|
|
+ isLogin: s.auth.isLogin
|
|
|
+}), {})(Header)
|
|
|
+
|
|
|
+export default CHeader;
|