Skip to content

Commit

Permalink
fix-siderbar-scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
igorihimbazwe committed Nov 19, 2024
1 parent 80f3565 commit 3d4c0d1
Show file tree
Hide file tree
Showing 19 changed files with 96 additions and 79 deletions.
6 changes: 3 additions & 3 deletions src/components/DashHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const TICKETS_NOTS_SUB = gql`
}
`;

function DashHeader() {
function DashHeader({minimize}: any) {
/* istanbul ignore next */
const { minimized, toggleMinMenu, showNav, toggleNav } =
useContext(MenuContext);
Expand Down Expand Up @@ -126,7 +126,7 @@ function DashHeader() {
handleShowProfileDropdown={handleShowProfileDropdown}
/>
)}
<div className="font-serif transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header">
<div className="font-serif h-16 transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header">
<div className="px-3 flex items-center w-full font-serif">
<div className="flex px-5 lg:hidden">
<div
Expand All @@ -144,7 +144,7 @@ function DashHeader() {
</div>
<div className="hidden lg:flex">
<div
onClick={toggleMinMenu}
onClick={() => { minimize(!minimized); return toggleMinMenu() }}
className="w-7"
role="button"
tabIndex={0}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ function Sidebar({ style, toggle }: { style: string; toggle: () => void }) {
<div
className={`${
showNav ? 'block' : 'hidden'
} lg:block page-sideNav fixed lg:static top-16 bottom-0 font-serif`}
} lg:block lg:z-0 z-50 fixed top-14 bottom-0 lg:h-[calc(100vh-3rem)] `}
>
<div
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`}
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`}
>
<div className="list-none">
<SideNavLink onClick={toggle} name="Dashboard" to="/dashboard">
Expand Down
9 changes: 4 additions & 5 deletions src/containers/DashRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,17 @@ const CoordinatorCards = React.lazy(
const AdminSission = React.lazy(() => import('./admin-dashBoard/Sessions'));

function DashRoutes() {
const { toggleNav } = useContext(MenuContext);

const { toggleNav } = useContext(MenuContext);
const [minimized, setMinimized] = useState(false);
const [nav, setNav] = useState(false);
const handleClick = () => setNav(!nav);

return (
<PrivateRoute>
<MenuProvider>
<DashHeader />
<DashHeader minimize={setMinimized} />
<Sidebar toggle={toggleNav} style="" />
</MenuProvider>
<main className=" px-4 md:px-8 py-4 md:py-8 w-[100%] bg-light-bg overflow-hidden dark:bg-dark-frame-bg">
<main className={`px-4 md:px-8 py-4 md:py-8 ${!minimized ? 'lg:w-[calc(100%-12rem)]' : 'lg:w-[calc(100%-5rem)]'} ml-auto mr-0 bg-light-bg overflow-hidden dark:bg-dark-frame-bg`}>
<Suspense>
<Routes>
<Route path="/dashboard" element={<Dashboard />} />
Expand Down
1 change: 0 additions & 1 deletion src/hook/menuProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const MenuContext = createContext<any>({
export function ThemeProvider({ children }: Props) {
const [minimized, setMinimized] = useState(false);
const [showNav, setShowNav] = useState(false);

const toggleMinMenu = () => setMinimized((p) => !p);

const toggleNav = () => setShowNav((p) => !p);
Expand Down
8 changes: 4 additions & 4 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,10 @@ th {
.page-layout {
display: grid;
grid-template-areas:
'header header'
'side_nav main'
'footer footer';
grid-template-columns: auto 1fr;
'header'
'main'
'footer';
grid-template-columns: auto;
grid-template-rows: auto 1fr auto;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ Array [
name="date"
readOnly={true}
type="text"
value="2024-11-14"
value="2024-11-19"
/>
</div>
<div
Expand Down
3 changes: 2 additions & 1 deletion tests/components/__snapshots__/DashHeader.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`DashHeader test Should render DashHeader 1`] = `
<div
className="font-serif transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header"
className="font-serif h-16 transform:sc w-full py-4 z-20 bg-indigo-100 dark:bg-dark-bg page-header"
>
<div
className="px-3 flex items-center w-full font-serif"
Expand Down Expand Up @@ -36,6 +36,7 @@ exports[`DashHeader test Should render DashHeader 1`] = `
>
<div
className="w-7"
onClick={[Function]}
role="button"
tabIndex={0}
>
Expand Down
8 changes: 7 additions & 1 deletion tests/components/__snapshots__/Footer.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,13 @@ exports[`<Footer/> Renders Header 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down
4 changes: 2 additions & 2 deletions tests/components/__snapshots__/SideNavLink.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ exports[`DashHeader test Should render navlink witthout active indicator 1`] =

exports[`DashHeader test Should render the sidebar with setings as active 1`] = `
<div
className="block lg:block page-sideNav fixed lg:static top-16 bottom-0 font-serif"
className="block lg:block lg:z-0 z-50 fixed top-14 bottom-0 lg:h-[calc(100vh-3rem)] "
>
<div
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"
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"
>
<div
className="list-none"
Expand Down
16 changes: 14 additions & 2 deletions tests/containers/__snapshots__/MainRoutes.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,13 @@ exports[`Main Routes Should render 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down Expand Up @@ -1509,7 +1515,13 @@ exports[`Main Routes Should render 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down
8 changes: 7 additions & 1 deletion tests/other-tests/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,13 @@ exports[`App test Should render app 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down
8 changes: 7 additions & 1 deletion tests/other-tests/__snapshots__/Siderbar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,13 @@ exports[`<Home /> Renders Home 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down
2 changes: 1 addition & 1 deletion tests/pages/TraineeAttendance.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,4 @@ describe('Renders the TraineeAttendance Page', () => {
expect(await screen.findByText("You don't have an attendance record in the system at the moment.")).toBeInTheDocument();
});

});
});
26 changes: 13 additions & 13 deletions tests/pages/__snapshots__/AdminLogin.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
exports[`Admin Login Should render 1`] = `
Array [
<div
className="grow dark:bg-dark-frame-bg bg-indigo-50 flex flex-row font-serif"
className="flex flex-row font-serif grow dark:bg-dark-frame-bg bg-indigo-50"
>
<div
className="hidden lg:flex w-[50%] h-full flex-col justify-center items-center mt-10 "
>
<div
className=" flex flex-col justify-center items-center "
className="flex flex-col items-center justify-center "
>
<div
className="relative flex flex-row justify-center"
Expand Down Expand Up @@ -40,13 +40,13 @@ Array [
className=" w-full lg:w-[50%] lg:p-5 flex flex-row items-end p-5"
>
<div
className="max-w-lg w-full mx-auto my-28 bg-indigo-100 dark:bg-dark-bg p-5 sm:p-5 md:shadow-xl sm:shadow-none md:rounded-xl sm:rounded-none"
className="w-full max-w-lg p-5 mx-auto bg-indigo-100 my-28 dark:bg-dark-bg sm:p-5 md:shadow-xl sm:shadow-none md:rounded-xl sm:rounded-none"
>
<div
className=""
>
<div
className="flex flex-col justify-center items-center"
className="flex flex-col items-center justify-center"
>
<h2
className="text-2xl font-bold text-primary dark:text-dark-text-fill "
Expand All @@ -59,7 +59,7 @@ Array [
/>
</div>
<div
className=" text-sm text-center dark:text-dark-text-fill"
className="text-sm text-center dark:text-dark-text-fill"
>
<a
className="mx-1 text-primary"
Expand Down Expand Up @@ -104,7 +104,7 @@ Array [
/>
</svg>
<input
className="bg-gray-100 outline-none text-sm flex-1 px-2 dark:border-white dark:bg-dark-bg dark:text-white "
className="flex-1 px-2 text-sm bg-gray-100 outline-none dark:border-white dark:bg-dark-bg dark:text-white "
data-testid="email"
name="email"
onBlur={[Function]}
Expand All @@ -114,13 +114,13 @@ Array [
/>
</div>
<div
className="text-left mb-1 pl-4"
className="pl-4 mb-1 text-left"
/>
<div
className="md:w-full border border-gray rounded-md bg-gray-100 p-2 my-4 flex items-center mb-2 dark:border-white dark:bg-dark-bg"
className="flex items-center p-2 my-4 mb-2 bg-gray-100 border rounded-md md:w-full border-gray dark:border-white dark:bg-dark-bg"
>
<svg
className="text-gray-400 mr-2 "
className="mr-2 text-gray-400 "
fill="currentColor"
height="1em"
stroke="currentColor"
Expand All @@ -143,7 +143,7 @@ Array [
/>
</svg>
<input
className="bg-gray-100 outline-none text-sm flex-1 dark:border-white dark:bg-dark-bg dark:text-white"
className="flex-1 text-sm bg-gray-100 outline-none dark:border-white dark:bg-dark-bg dark:text-white"
data-testid="password"
name="password"
onBlur={[Function]}
Expand Down Expand Up @@ -187,7 +187,7 @@ Array [
className="pl-4 mb-1 text-left"
/>
<div
className="flex w-full flex-col sm:flex-row justify-between items-center rounded mb-5 mt-5"
className="flex flex-col items-center justify-between w-full mt-5 mb-5 rounded sm:flex-row"
>
<div
className="w-50%"
Expand All @@ -197,7 +197,7 @@ Array [
htmlFor="checkbox"
>
<input
className="mr-1 dark:text-dark-text-fill dark:border-white dark:bg-dark-frame-bg"
className="mr-1 dark:text-dark-text-fill dark:border-white dark:bg-dark-frame-bg"
name="remember"
type="checkbox"
/>
Expand All @@ -217,7 +217,7 @@ Array [
</div>
</div>
<div
className="w-full justify-center"
className="justify-center w-full"
>
<button
className="btn transparentbtn md w-full bg-primary m-0 inline-block rounded-md lg:px-12 lg:py-2 sm:px-4 sm:py-1 md:font-semibold sm:mt-2 sm:font-medium text-white font-serif "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ Array [
name="date"
readOnly={true}
type="text"
value="2024-11-14"
value="2024-11-19"
/>
</div>
<div
Expand Down
8 changes: 7 additions & 1 deletion tests/pages/__snapshots__/Home.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,13 @@ exports[`Home page renders the landing page 1`] = `
<li
className="mb-1"
>
Community
<a
href="/community"
onClick={[Function]}
>
Community
</a>
</li>
<li
className="mb-1"
Expand Down
Loading

0 comments on commit 3d4c0d1

Please sign in to comment.