diff --git a/src/containers/LeftSidebar.js b/src/containers/LeftSidebar.js index b06fcb2..63e049d 100644 --- a/src/containers/LeftSidebar.js +++ b/src/containers/LeftSidebar.js @@ -1,57 +1,69 @@ -import routes from '../routes/sidebar' -import { NavLink, Routes, Link , useLocation} from 'react-router-dom' -import SidebarSubmenu from './SidebarSubmenu'; -import XMarkIcon from '@heroicons/react/24/outline/XMarkIcon' -import { useDispatch } from 'react-redux'; +import routes from "../routes/sidebar"; +import { NavLink, Routes, Link, useLocation } from "react-router-dom"; +import SidebarSubmenu from "./SidebarSubmenu"; +import XMarkIcon from "@heroicons/react/24/outline/XMarkIcon"; +import { useDispatch } from "react-redux"; -function LeftSidebar(){ - const location = useLocation(); +function LeftSidebar() { + const location = useLocation(); - const dispatch = useDispatch() + const dispatch = useDispatch(); + const close = (e) => { + document.getElementById("left-sidebar-drawer").click(); + }; - const close = (e) => { - document.getElementById('left-sidebar-drawer').click() - } + return ( +
+ + +
+ ); } -export default LeftSidebar \ No newline at end of file +export default LeftSidebar; diff --git a/src/containers/RightSidebar.js b/src/containers/RightSidebar.js index 31516fb..ee987a3 100644 --- a/src/containers/RightSidebar.js +++ b/src/containers/RightSidebar.js @@ -1,60 +1,81 @@ -import XMarkIcon from '@heroicons/react/24/solid/XMarkIcon' -import { useDispatch, useSelector } from 'react-redux' -import NotificationBodyRightDrawer from '../features/common/components/NotificationBodyRightDrawer' -import { closeRightDrawer } from '../features/common/rightDrawerSlice' -import { RIGHT_DRAWER_TYPES } from '../utils/globalConstantUtil' -import CalendarEventsBodyRightDrawer from '../features/calendar/CalendarEventsBodyRightDrawer' +import XMarkIcon from "@heroicons/react/24/solid/XMarkIcon"; +import { useDispatch, useSelector } from "react-redux"; +import NotificationBodyRightDrawer from "../features/common/components/NotificationBodyRightDrawer"; +import { closeRightDrawer } from "../features/common/rightDrawerSlice"; +import { RIGHT_DRAWER_TYPES } from "../utils/globalConstantUtil"; +import CalendarEventsBodyRightDrawer from "../features/calendar/CalendarEventsBodyRightDrawer"; +function RightSidebar() { + const { isOpen, bodyType, extraObject, header } = useSelector( + (state) => state.rightDrawer + ); + const dispatch = useDispatch(); -function RightSidebar(){ + const close = (e) => { + dispatch(closeRightDrawer(e)); + }; - const {isOpen, bodyType, extraObject, header} = useSelector(state => state.rightDrawer) - const dispatch = useDispatch() + return ( +
+
+
+ {/* Header */} +
+ +

Halo

+ {header} +
- const close = (e) => { - dispatch(closeRightDrawer(e)) - } - - - - return( -
- -
- -
- - {/* Header */} -
- - {header} -
- - - {/* ------------------ Content Start ------------------ */} -
-
- {/* Loading drawer body according to different drawer type */} - { - { - [RIGHT_DRAWER_TYPES.NOTIFICATION] : , - [RIGHT_DRAWER_TYPES.CALENDAR_EVENTS] : , - [RIGHT_DRAWER_TYPES.DEFAULT] :
- }[bodyType] - } - -
-
- {/* ------------------ Content End ------------------ */} -
- -
- -
close()} >
+ {/* ------------------ Content Start ------------------ */} +
+
+ {/* Loading drawer body according to different drawer type */} + { + { + [RIGHT_DRAWER_TYPES.NOTIFICATION]: ( + + ), + [RIGHT_DRAWER_TYPES.CALENDAR_EVENTS]: ( + + ), + [RIGHT_DRAWER_TYPES.DEFAULT]:
, + }[bodyType] + } +
+
+ {/* ------------------ Content End ------------------ */}
- ) +
+ +
close()} + >
+
+ ); } -export default RightSidebar \ No newline at end of file +export default RightSidebar; diff --git a/src/containers/SidebarSubmenu.js b/src/containers/SidebarSubmenu.js index f7642c5..fc681b7 100644 --- a/src/containers/SidebarSubmenu.js +++ b/src/containers/SidebarSubmenu.js @@ -1,49 +1,56 @@ -import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon' -import {useEffect, useState} from 'react' -import { Link, useLocation } from 'react-router-dom' - - -function SidebarSubmenu({submenu, name, icon}){ - const location = useLocation() - const [isExpanded, setIsExpanded] = useState(false) - - - /** Open Submenu list if path found in routes, this is for directly loading submenu routes first time */ - useEffect(() => { - if(submenu.filter(m => {return m.path === location.pathname})[0])setIsExpanded(true) - }, []) - - return ( -
- - {/** Route header */} -
setIsExpanded(!isExpanded)}> - {icon} {name} - -
- - {/** Submenu list */} -
- -
-
+import ChevronDownIcon from "@heroicons/react/24/outline/ChevronDownIcon"; +import { useEffect, useState } from "react"; +import { Link, useLocation } from "react-router-dom"; + +function SidebarSubmenu({ submenu, name, icon }) { + const location = useLocation(); + const [isExpanded, setIsExpanded] = useState(false); + + /** Open Submenu list if path found in routes, this is for directly loading submenu routes first time */ + useEffect(() => { + if ( + submenu.filter((m) => { + return m.path === location.pathname; + })[0] ) + setIsExpanded(true); + }, []); + + return ( +
+ {/** Route header */} +
setIsExpanded(!isExpanded)}> + {icon} {name} + +
+ + {/** Submenu list */} +
+ +
+
+ ); } -export default SidebarSubmenu \ No newline at end of file +export default SidebarSubmenu;