diff --git a/src/components/LeftDrawer/LeftDrawer.module.css b/src/components/LeftDrawer/LeftDrawer.module.css index 6818dc05fb..a75b674b41 100644 --- a/src/components/LeftDrawer/LeftDrawer.module.css +++ b/src/components/LeftDrawer/LeftDrawer.module.css @@ -104,6 +104,10 @@ text-transform: capitalize; } +.logout { + margin-bottom: 50px; +} + @media (max-width: 1120px) { .leftDrawer { width: calc(250px + 2rem); @@ -145,6 +149,10 @@ z-index: 100; animation: openDrawer 0.6s ease-in-out; } + + .logout { + margin-bottom: 1.5rem !important; + } } @keyframes goToLeftBigScreen { diff --git a/src/components/LeftDrawer/LeftDrawer.tsx b/src/components/LeftDrawer/LeftDrawer.tsx index d8708e2327..d2fdfedbcb 100644 --- a/src/components/LeftDrawer/LeftDrawer.tsx +++ b/src/components/LeftDrawer/LeftDrawer.tsx @@ -165,7 +165,7 @@ const leftDrawer = ({ + ) : ( + + )} +
+ +
{title}
diff --git a/src/components/SuperAdminScreen/SuperAdminScreen.module.css b/src/components/SuperAdminScreen/SuperAdminScreen.module.css index 681ac8823d..2d50abe807 100644 --- a/src/components/SuperAdminScreen/SuperAdminScreen.module.css +++ b/src/components/SuperAdminScreen/SuperAdminScreen.module.css @@ -6,7 +6,7 @@ } .expand { - padding-left: 1.5rem; + padding-left: 4rem; animation: moveLeft 0.5s ease-in-out; } @@ -15,10 +15,48 @@ animation: moveRight 0.5s ease-in-out; } +.collapseSidebarButton { + position: fixed; + height: 40px; + bottom: 0; + z-index: 9999; + width: calc(300px + 2rem); + background-color: rgba(245, 245, 245, 0.7); + color: black; + border: none; + border-radius: 0px; +} + +.collapseSidebarButton:hover, +.opendrawer:hover { + opacity: 1; + color: black !important; +} +.opendrawer { + position: fixed; + top: 0; + left: 0; + width: 40px; + height: 100vh; + z-index: 9999; + background-color: rgba(245, 245, 245); + border: none; + border-radius: 0px; + margin-right: 20px; + color: black; +} + +.mobileopenBtn { + display: none; +} + @media (max-width: 1120px) { .contract { padding-left: calc(250px + 2rem + 1.5rem); } + .collapseSidebarButton { + width: calc(250px + 2rem); + } } /* For tablets */ @@ -31,12 +69,24 @@ .expand { animation: none; } + + .collapseSidebarButton { + display: none; + } } @media (max-width: 820px) { .pageContainer { padding: 1rem; } + + .mobileopenBtn { + display: block; + } + .opendrawer, + .collapseSidebarButton { + display: none; + } } @keyframes moveLeft { diff --git a/src/components/SuperAdminScreen/SuperAdminScreen.test.tsx b/src/components/SuperAdminScreen/SuperAdminScreen.test.tsx index e578b0bb4f..e3bce81dc6 100644 --- a/src/components/SuperAdminScreen/SuperAdminScreen.test.tsx +++ b/src/components/SuperAdminScreen/SuperAdminScreen.test.tsx @@ -18,7 +18,22 @@ const props: InterfaceSuperAdminScreenProps = { children:
Testing ...
, }; +type SetScreenSize = () => void; + describe('Testing LeftDrawer in SuperAdminScreen', () => { + const setTabletScreenSize: SetScreenSize = () => { + Object.defineProperty(window, 'innerWidth', { + writable: true, + configurable: true, + value: 768, // Example: setting tablet width + }); + Object.defineProperty(window, 'innerHeight', { + writable: true, + configurable: true, + value: 1024, // Example: setting tablet height + }); + window.dispatchEvent(new Event('resize')); + }; test('Testing LeftDrawer in page functionality', async () => { localStorage.setItem('UserType', 'SUPERADMIN'); @@ -37,6 +52,30 @@ describe('Testing LeftDrawer in SuperAdminScreen', () => { // Expand LeftDrawer userEvent.click(screen.getByTestId('menuBtn')); // Contract LeftDrawer - userEvent.click(screen.getByTestId('menuBtn')); + userEvent.click(screen.getByTestId('openMenu')); + }); + test('Testing expanding and closing on a tablet-sized screen', async () => { + localStorage.setItem('UserType', 'SUPERADMIN'); + + // Render the component with tablet-sized screen + render( + + + + + + + + + + ); + + // Set the screen size to simulate a tablet + setTabletScreenSize(); + + // sets hideDrawer to true + userEvent.click(screen.getByTestId('menuBtnmobile')); + // sets hideDrawer to false + userEvent.click(screen.getByTestId('closeModalBtn')); }); }); diff --git a/src/components/SuperAdminScreen/SuperAdminScreen.tsx b/src/components/SuperAdminScreen/SuperAdminScreen.tsx index 214b8bd1ed..c598d08d25 100644 --- a/src/components/SuperAdminScreen/SuperAdminScreen.tsx +++ b/src/components/SuperAdminScreen/SuperAdminScreen.tsx @@ -16,8 +16,31 @@ const superAdminScreen = ({ }: InterfaceSuperAdminScreenProps): JSX.Element => { const [hideDrawer, setHideDrawer] = useState(null); + const toggleDrawerVisibility = (): void => { + setHideDrawer(!hideDrawer); + }; + return ( <> + {hideDrawer ? ( + + ) : ( + + )} {title}