Skip to content

Commit 0b14790

Browse files
Fx sidebar scroll (#632)
* fix-siderbar-scroll * fix-siderbar-scroll
1 parent dc3387c commit 0b14790

19 files changed

+96
-79
lines changed

src/components/DashHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const TICKETS_NOTS_SUB = gql`
3939
}
4040
`;
4141

42-
function DashHeader() {
42+
function DashHeader({minimize}: any) {
4343
/* istanbul ignore next */
4444
const { minimized, toggleMinMenu, showNav, toggleNav } =
4545
useContext(MenuContext);
@@ -126,7 +126,7 @@ function DashHeader() {
126126
handleShowProfileDropdown={handleShowProfileDropdown}
127127
/>
128128
)}
129-
<div className="font-serif transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header">
129+
<div className="font-serif h-16 transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header">
130130
<div className="px-3 flex items-center w-full font-serif">
131131
<div className="flex px-5 lg:hidden">
132132
<div
@@ -144,7 +144,7 @@ function DashHeader() {
144144
</div>
145145
<div className="hidden lg:flex">
146146
<div
147-
onClick={toggleMinMenu}
147+
onClick={() => { minimize(!minimized); return toggleMinMenu() }}
148148
className="w-7"
149149
role="button"
150150
tabIndex={0}

src/components/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ function Sidebar({ style, toggle }: { style: string; toggle: () => void }) {
3939
<div
4040
className={`${
4141
showNav ? 'block' : 'hidden'
42-
} lg:block page-sideNav fixed lg:static top-16 bottom-0 font-serif`}
42+
} lg:block lg:z-0 z-50 fixed top-14 bottom-0 lg:h-[calc(100vh-3rem)] `}
4343
>
4444
<div
45-
className={`${style} overflow-auto flex-col h-[100%] pt-2 bg-indigo-100 dark:bg-dark-bg shadow-lg lg:shadow-none dark:shadow-border-dark`}
45+
className={`${style} overflow-auto flex-col h-[100%] px-3 py-8 bg-indigo-100 dark:bg-dark-bg shadow-lg lg:shadow-none dark:shadow-border-dark`}
4646
>
4747
<div className="list-none">
4848
<SideNavLink onClick={toggle} name="Dashboard" to="/dashboard">

src/containers/DashRoutes.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,17 @@ const CoordinatorCards = React.lazy(
8383
const AdminSission = React.lazy(() => import('./admin-dashBoard/Sessions'));
8484

8585
function DashRoutes() {
86-
const { toggleNav } = useContext(MenuContext);
87-
86+
const { toggleNav } = useContext(MenuContext);
87+
const [minimized, setMinimized] = useState(false);
8888
const [nav, setNav] = useState(false);
8989
const handleClick = () => setNav(!nav);
90-
9190
return (
9291
<PrivateRoute>
9392
<MenuProvider>
94-
<DashHeader />
93+
<DashHeader minimize={setMinimized} />
9594
<Sidebar toggle={toggleNav} style="" />
9695
</MenuProvider>
97-
<main className=" px-4 md:px-8 py-4 md:py-8 w-[100%] bg-light-bg overflow-hidden dark:bg-dark-frame-bg">
96+
<main className={`px-4 md:px-8 py-4 md:py-8 ${!minimized ? 'lg:w-[calc(100%-14rem)]' : 'lg:w-[calc(100%-5rem)]'} ml-auto mr-0 bg-light-bg overflow-hidden dark:bg-dark-frame-bg`}>
9897
<Suspense>
9998
<Routes>
10099
<Route path="/dashboard" element={<Dashboard />} />

src/hook/menuProvider.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const MenuContext = createContext<any>({
1414
export function ThemeProvider({ children }: Props) {
1515
const [minimized, setMinimized] = useState(false);
1616
const [showNav, setShowNav] = useState(false);
17-
1817
const toggleMinMenu = () => setMinimized((p) => !p);
1918

2019
const toggleNav = () => setShowNav((p) => !p);

src/index.css

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,10 +484,10 @@ th {
484484
.page-layout {
485485
display: grid;
486486
grid-template-areas:
487-
'header header'
488-
'side_nav main'
489-
'footer footer';
490-
grid-template-columns: auto 1fr;
487+
'header'
488+
'main'
489+
'footer';
490+
grid-template-columns: auto;
491491
grid-template-rows: auto 1fr auto;
492492
}
493493

tests/components/__snapshots__/AdminTraineeDashboard.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ Array [
463463
name="date"
464464
readOnly={true}
465465
type="text"
466-
value="2024-11-14"
466+
value="2024-11-19"
467467
/>
468468
</div>
469469
<div

tests/components/__snapshots__/DashHeader.test.tsx.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`DashHeader test Should render DashHeader 1`] = `
44
<div
5-
className="font-serif transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header"
5+
className="font-serif h-16 transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header"
66
>
77
<div
88
className="px-3 flex items-center w-full font-serif"
@@ -36,6 +36,7 @@ exports[`DashHeader test Should render DashHeader 1`] = `
3636
>
3737
<div
3838
className="w-7"
39+
onClick={[Function]}
3940
role="button"
4041
tabIndex={0}
4142
>

tests/components/__snapshots__/Footer.test.tsx.snap

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,13 @@ exports[`<Footer/> Renders Header 1`] = `
216216
<li
217217
className="mb-1"
218218
>
219-
Community
219+
<a
220+
href="/community"
221+
onClick={[Function]}
222+
>
223+
Community
224+
225+
</a>
220226
</li>
221227
<li
222228
className="mb-1"

tests/components/__snapshots__/SideNavLink.test.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ exports[`DashHeader test Should render navlink witthout active indicator 1`] =
2121

2222
exports[`DashHeader test Should render the sidebar with setings as active 1`] = `
2323
<div
24-
className="block lg:block page-sideNav fixed lg:static top-16 bottom-0 font-serif"
24+
className="block lg:block lg:z-0 z-50 fixed top-14 bottom-0 lg:h-[calc(100vh-3rem)] "
2525
>
2626
<div
27-
className=" overflow-auto flex-col h-[100%] pt-2 bg-indigo-100 dark:bg-dark-bg shadow-lg lg:shadow-none dark:shadow-border-dark"
27+
className=" overflow-auto flex-col h-[100%] px-3 py-8 bg-indigo-100 dark:bg-dark-bg shadow-lg lg:shadow-none dark:shadow-border-dark"
2828
>
2929
<div
3030
className="list-none"

tests/containers/__snapshots__/MainRoutes.test.tsx.snap

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,13 @@ exports[`Main Routes Should render 1`] = `
12241224
<li
12251225
className="mb-1"
12261226
>
1227-
Community
1227+
<a
1228+
href="/community"
1229+
onClick={[Function]}
1230+
>
1231+
Community
1232+
1233+
</a>
12281234
</li>
12291235
<li
12301236
className="mb-1"
@@ -1509,7 +1515,13 @@ exports[`Main Routes Should render 1`] = `
15091515
<li
15101516
className="mb-1"
15111517
>
1512-
Community
1518+
<a
1519+
href="/community"
1520+
onClick={[Function]}
1521+
>
1522+
Community
1523+
1524+
</a>
15131525
</li>
15141526
<li
15151527
className="mb-1"

0 commit comments

Comments
 (0)