From 9460935e0a56126deeb8a8613274064bd282f439 Mon Sep 17 00:00:00 2001 From: caturbgs Date: Wed, 22 Dec 2021 16:58:24 +0700 Subject: [PATCH] style: add margin into profile popover --- src/index.css | 7 +- src/pages/App/DesktopLayout.js | 173 +++++++++++++++++---------------- 2 files changed, 94 insertions(+), 86 deletions(-) diff --git a/src/index.css b/src/index.css index 3c1a8ed..18d9f14 100644 --- a/src/index.css +++ b/src/index.css @@ -61,8 +61,9 @@ code { background-color: #e3e8ee !important; } .ant-menu-submenu-arrow{ - padding-right: 40px !important; + padding-right: 40px !important; } + .ant-breadcrumb { margin-bottom: 10px !important; } @@ -70,4 +71,8 @@ code { .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn { color: #ed1f24 !important; border-color: #ed1f24 !important; +} + +.profile-container .ant-popover-inner-content { + padding: 0 !important; } \ No newline at end of file diff --git a/src/pages/App/DesktopLayout.js b/src/pages/App/DesktopLayout.js index ffe6524..047bd99 100644 --- a/src/pages/App/DesktopLayout.js +++ b/src/pages/App/DesktopLayout.js @@ -1,64 +1,64 @@ -import React, { useState } from "react"; -import { Button, Drawer, Layout, Menu, Popover, Typography } from "antd"; -import { MenuList } from "./MenuList"; -import { Link, useHistory } from "react-router-dom"; +import React, {useState} from "react"; +import {Button, Drawer, Layout, Menu, Popover, Typography} from "antd"; +import {MenuList} from "./MenuList"; +import {Link, useHistory} from "react-router-dom"; import { - HomeOutlined, - MenuOutlined, - UserOutlined, - ProfileOutlined, - DatabaseOutlined, - FileAddOutlined, - FileSyncOutlined, - FileProtectOutlined, - ShoppingCartOutlined, - AlipayOutlined, - PayCircleOutlined + AlipayOutlined, + DatabaseOutlined, + FileAddOutlined, + FileProtectOutlined, + FileSyncOutlined, + HomeOutlined, + MenuOutlined, + PayCircleOutlined, + ProfileOutlined, + ShoppingCartOutlined, + UserOutlined } from "@ant-design/icons"; -import { AppRoute, LINKS } from "../../routes/app"; -import { useStore } from "../../utils/useStore"; -import { observer } from "mobx-react-lite"; -import { useMediaQuery } from "react-responsive"; +import {AppRoute, LINKS} from "../../routes/app"; +import {useStore} from "../../utils/useStore"; +import {observer} from "mobx-react-lite"; +import {useMediaQuery} from "react-responsive"; -const { Text, Paragraph } = Typography; -const { Header, Content, Sider } = Layout; -const { SubMenu } = Menu; +const {Text, Paragraph} = Typography; +const {Header, Content, Sider} = Layout; +const {SubMenu} = Menu; export const DesktopLayout = observer(() => { - let history = useHistory(); - const xl = useMediaQuery({ minWidth: 1024 }); - const store = useStore(); - const [clicked, setClicked] = useState(false); + let history = useHistory(); + const xl = useMediaQuery({minWidth: 1024}); + const store = useStore(); + const [clicked, setClicked] = useState(false); - return ( - - {store.ui.mediaQuery.isDesktop && ( - + {store.ui.mediaQuery.isDesktop && ( +
{ autoAdjustOverflow={true} placement="bottomRight" content={ - - - - Profile - - - { - store.authentication.logout(); - history.push("/login"); - }} + - Sign out - - + {store.authentication.userData.role !== "Admin" && ( + + + + Profile + + + )} + { + store.authentication.logout(); + history.push("/login"); + }} + > + Sign out + + } title={ - {store.user.data.email}{" "} - - {store.authentication.userData.username} - + + {store.authentication.userData.username} + } trigger="click"