Skip to content

Commit 542995f

Browse files
authored
Don't add 200px left margin for toolbar on sign-in page. (#404)
1 parent 8aae5f4 commit 542995f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/layout/Layout.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
/* Medium Devices, Desktops */
4747
@media only screen and (min-width: 992px) {
48-
.main {
48+
.main.hasNavBar {
4949
margin-left: 200px;
5050
}
5151
}

src/components/layout/Layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ import NavBar from "../navbar/NavBar";
33
import $layout from "./Layout.module.css";
44
import { useRouter } from "next/router";
55
import { requiresLogin } from "@/client/lib/authenticated-page";
6+
import { useSession } from "next-auth/react";
67

78
interface LayoutProps {
89
children: React.ReactNode;
910
}
1011

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

1922
return (
2023
<div className={$layout.container}>
@@ -24,7 +27,8 @@ const Layout = ({ children }: LayoutProps) => {
2427
${router.query.student_id ? $layout.mainStudent : ""}
2528
${router.query.goal_id ? $layout.mainGoal : ""}
2629
${router.query.user_id ? $layout.mainStaff : ""}
27-
${router.pathname.includes("benchmarks") ? $layout.mainPurple : ""}`}
30+
${router.pathname.includes("benchmarks") ? $layout.mainPurple : ""}
31+
${hasNavBar ? $layout.hasNavBar : ""}`}
2832
>
2933
{children}
3034
</main>

0 commit comments

Comments
 (0)