logout button in side menu
parent
5cddd3e70c
commit
714dd8b919
|
@ -13,7 +13,7 @@ function App() {
|
||||||
<>
|
<>
|
||||||
{loggedIn ? (
|
{loggedIn ? (
|
||||||
<Layout style={{ minHeight: "100vh" }}>
|
<Layout style={{ minHeight: "100vh" }}>
|
||||||
<SideMenu></SideMenu>
|
<SideMenu setLoggedIn={setLoggedIn}></SideMenu>
|
||||||
<PageContent></PageContent>
|
<PageContent></PageContent>
|
||||||
</Layout>
|
</Layout>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Content } from "antd/es/layout/layout";
|
import { Content, Footer } from "antd/es/layout/layout";
|
||||||
import AppRoutes from "../AppRoutes";
|
import AppRoutes from "../AppRoutes";
|
||||||
|
|
||||||
function PageContent() {
|
function PageContent() {
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
import { AppstoreOutlined, SnippetsOutlined } from "@ant-design/icons";
|
import {
|
||||||
import { Menu } from "antd";
|
AppstoreOutlined,
|
||||||
|
LogoutOutlined,
|
||||||
|
SnippetsOutlined,
|
||||||
|
UserOutlined,
|
||||||
|
} from "@ant-design/icons";
|
||||||
|
import { Divider, Menu } from "antd";
|
||||||
import Sider from "antd/es/layout/Sider";
|
import Sider from "antd/es/layout/Sider";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
function SideMenu() {
|
export default function SideMenu({ setLoggedIn }) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [selectedKeys, setSelectedKeys] = useState("/");
|
const [selectedKeys, setSelectedKeys] = useState("/");
|
||||||
|
|
||||||
|
@ -19,6 +25,15 @@ function SideMenu() {
|
||||||
theme="light"
|
theme="light"
|
||||||
style={{ overflow: "auto", position: "fixed", height: "100vh" }}
|
style={{ overflow: "auto", position: "fixed", height: "100vh" }}
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
flexDirection: "column",
|
||||||
|
height: "100%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
<div className="CompanyName">JANEX</div>
|
<div className="CompanyName">JANEX</div>
|
||||||
<div className="Subtitle">Admin Dashboard</div>
|
<div className="Subtitle">Admin Dashboard</div>
|
||||||
<Menu
|
<Menu
|
||||||
|
@ -40,8 +55,27 @@ function SideMenu() {
|
||||||
key: "/group-tasks",
|
key: "/group-tasks",
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
></Menu>
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Divider />
|
||||||
|
<Menu
|
||||||
|
selectable={false}
|
||||||
|
mode="vertical"
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
label: "Logout",
|
||||||
|
icon: <LogoutOutlined />,
|
||||||
|
onClick: () => setLoggedIn(false),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Sider>
|
</Sider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default SideMenu;
|
|
||||||
|
SideMenu.propTypes = {
|
||||||
|
setLoggedIn: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { LockOutlined, UserOutlined } from "@ant-design/icons";
|
import { LockOutlined, LoginOutlined, UserOutlined } from "@ant-design/icons";
|
||||||
import { Button, Form, Input } from "antd";
|
import { Button, Form, Input } from "antd";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ export default function Login({ setLoggedIn }) {
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
|
icon={<LoginOutlined />}
|
||||||
className="login-form-button"
|
className="login-form-button"
|
||||||
onClick={() => setLoggedIn(true)}
|
onClick={() => setLoggedIn(true)}
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue