Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 08daee3

Browse files
sidebar hided and header nav added
1 parent 5c1f812 commit 08daee3

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

src/components/common/HeadNavbar.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import React from 'react';
2+
import { Menu, Row, Col } from 'antd';
3+
import { UserOutlined, LogoutOutlined } from '@ant-design/icons';
4+
import { SESSION } from '../../services';
5+
6+
const { SubMenu } = Menu;
7+
8+
export default function HeadNavbar() {
9+
const handleClick = (e) => {
10+
console.log('click ', e);
11+
if (e.key === 'logout') {
12+
SESSION.logout();
13+
}
14+
};
15+
16+
return (
17+
<Row justify="end" align="center">
18+
<Col span={24}>
19+
<Menu onClick={handleClick} mode="horizontal">
20+
<SubMenu
21+
icon={<UserOutlined />}
22+
title="Profile"
23+
style={{ float: 'right' }}
24+
>
25+
<Menu.Item icon={<LogoutOutlined />} key="logout">
26+
Logout
27+
</Menu.Item>
28+
</SubMenu>
29+
</Menu>
30+
</Col>
31+
</Row>
32+
);
33+
}

src/components/common/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as ErrorBoundary } from './ErrorBoundary';
2+
export { default as HeadNavbar } from './HeadNavbar';
23
export { default as Loader } from './Loader';

src/components/routes/PrivateRoute.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Layout } from 'antd';
44
import { useDispatch } from 'react-redux';
55
import { SESSION } from '../../services';
66
import { Sidebar } from '../sidebar';
7+
import { HeadNavbar } from '../common';
78

89
const { Content } = Layout;
910

@@ -27,8 +28,9 @@ function PrivateRoute({ children, location, ...rest }) {
2728
if (SESSION.isLoggedIn()) {
2829
return (
2930
<Layout>
30-
<Sidebar />
31+
{/* <Sidebar /> */}
3132
<Content>
33+
<HeadNavbar />
3234
<div className="p-10 height-100">
3335
<Route {...rest}>{children}</Route>
3436
</div>

src/forms/todo/todo.form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function TodoForm({ onClose }) {
200200
}
201201

202202
TodoForm.propTypes = {
203-
// onClose: PropTypes.func.isRequired,
203+
onClose: PropTypes.func.isRequired,
204204
};
205205

206206
export { TodoForm };

0 commit comments

Comments
 (0)