2020-12-09 09:15:55 +01:00
|
|
|
import * as BS from 'react-bootstrap'
|
2020-12-09 17:45:11 +01:00
|
|
|
import useDarkMode from 'use-dark-mode';
|
|
|
|
|
import Toggle from 'react-toggle'
|
|
|
|
|
import { FaSun, FaMoon } from "react-icons/fa";
|
2020-12-09 09:15:55 +01:00
|
|
|
|
2020-12-09 17:45:11 +01:00
|
|
|
import "react-toggle/style.css"
|
2020-12-11 16:35:25 +01:00
|
|
|
import history from "../History.js";
|
2020-12-09 09:15:55 +01:00
|
|
|
|
2020-12-11 16:35:25 +01:00
|
|
|
export default function Navigation() {
|
2020-12-09 17:45:11 +01:00
|
|
|
|
|
|
|
|
const darkMode = useDarkMode(false);
|
2020-12-09 09:15:55 +01:00
|
|
|
|
|
|
|
|
function logOut() {
|
|
|
|
|
localStorage.removeItem("token");
|
|
|
|
|
localStorage.removeItem("user");
|
2020-12-11 16:35:25 +01:00
|
|
|
history.push('/pk-webs');
|
2020-12-09 09:15:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2020-12-09 22:40:14 +01:00
|
|
|
<BS.Navbar className="mb-3 align-items-center justify-content-between">
|
2020-12-09 09:15:55 +01:00
|
|
|
<BS.Navbar.Brand>
|
|
|
|
|
pk-web
|
|
|
|
|
</BS.Navbar.Brand>
|
2020-12-09 22:40:14 +01:00
|
|
|
<BS.Nav className="mr-lg-2 d-flex align-items-center row">
|
2020-12-09 17:45:11 +01:00
|
|
|
<Toggle
|
|
|
|
|
defaultChecked={true}
|
|
|
|
|
icons={false}
|
|
|
|
|
onChange={darkMode.toggle} />
|
|
|
|
|
{darkMode.value ? <FaMoon className="m-1"/> : <FaSun className="m-1"/>}
|
|
|
|
|
</BS.Nav>
|
2020-12-09 09:15:55 +01:00
|
|
|
<BS.Form inline>
|
2020-12-09 22:40:14 +01:00
|
|
|
{ localStorage.getItem('token') ? <BS.Button className=" mr-lg-2" variant="primary" onClick={logOut}>Log Out</BS.Button> : "" }
|
2020-12-09 09:15:55 +01:00
|
|
|
</BS.Form>
|
|
|
|
|
</BS.Navbar>
|
|
|
|
|
)
|
|
|
|
|
}
|