From 03b7836e3a5788006945feabd848cb05db6e6341 Mon Sep 17 00:00:00 2001 From: developomp Date: Tue, 24 Aug 2021 16:55:13 +0900 Subject: [PATCH] moved sidebar collapse button --- src/components/Sidebar.tsx | 88 ++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 27 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 9b37b48..9d9744e 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -1,39 +1,73 @@ +import { useContext } from "react" + import { Layout, Menu } from "antd" +import { blue } from "@ant-design/colors" import { - UserOutlined, - VideoCameraOutlined, - UploadOutlined, + AppstoreAddOutlined, + ClockCircleOutlined, + CaretLeftFilled, + CaretRightFilled, + DashboardOutlined, + ExclamationCircleOutlined, } from "@ant-design/icons" import { SidebarCollapsedContext } from "../contexts" +import styled from "styled-components" + +const StyledMenuContainer = styled.div` + svg { + font-size: 1.25rem; + } +` + +const SidebarCollapseButton = styled.div` + :hover { + background-color: ${blue[5]}; + } +` const Sidebar = () => { + const { isSidebarCollapsed, setSidebarCollapsed } = useContext( + SidebarCollapsedContext + ) + return ( - - {({ isSidebarCollapsed }) => ( - - + + + }> + Dashboard + + }> + Modules + + }>Logs + }> + Incidents + + { + setSidebarCollapsed((prev) => !prev) + }} > - }> - nav 1 - - }> - nav 2 - - }> - nav 3 - - - - )} - + {isSidebarCollapsed ? ( + + ) : ( + + )} + + + + ) }