Skip to content

Commit

Permalink
Don't add 200px left margin for toolbar on sign-in page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrabbitt committed Sep 4, 2024
1 parent 6f1c66d commit cabf72d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/layout/Layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

/* Medium Devices, Desktops */
@media only screen and (min-width: 992px) {
.main {
.main.hasNavBar {
margin-left: 200px;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ import NavBar from "../navbar/NavBar";
import $layout from "./Layout.module.css";
import { useRouter } from "next/router";
import { requiresLogin } from "@/client/lib/authenticated-page";
import { useSession } from "next-auth/react";

interface LayoutProps {
children: React.ReactNode;
}

const Layout = ({ children }: LayoutProps) => {
const router = useRouter();
const { status } = useSession();
// TODO?: Are there better ways to achieve this?
//Sets purple background for student profile and instructions routes
const isPurpleBg =
router.asPath.includes("/studentprofile") ||
router.asPath.includes("/instructions");
const hasNavBar = "authenticated" == status;

return (
<div className={$layout.container}>
Expand All @@ -24,7 +27,8 @@ const Layout = ({ children }: LayoutProps) => {
${router.query.student_id ? $layout.mainStudent : ""}
${router.query.goal_id ? $layout.mainGoal : ""}
${router.query.user_id ? $layout.mainStaff : ""}
${router.pathname.includes("benchmarks") ? $layout.mainPurple : ""}`}
${router.pathname.includes("benchmarks") ? $layout.mainPurple : ""}
${hasNavBar ? $layout.hasNavBar : ""}`}
>
{children}
</main>
Expand Down

0 comments on commit cabf72d

Please sign in to comment.