Skip to content

Commit 7a5af83

Browse files
committed
fix: check in navigation component if page location is /blog
1 parent ba00e79 commit 7a5af83

File tree

3 files changed

+20
-259
lines changed

3 files changed

+20
-259
lines changed

apps/website/src/components/navigation.astro

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import crocoderLogo from "../assets/crocoder-logo.png";
44
import Menu from "./Menu.astro";
55
import MenuItem from "./MenuItem.astro";
66
7+
const { position } = Astro.props;
8+
79
const optimizedLogo = await getImage({
810
src: crocoderLogo,
911
width: 63,
@@ -26,16 +28,18 @@ const caseStudies = [
2628
},
2729
];
2830
31+
const isBlogPage = Astro.url.pathname.startsWith("/blog");
32+
2933
const href = "#book-a-call-section";
3034
---
3135

3236
<header
33-
class="fixed m-auto
34-
top-0
35-
md:mx-2
36-
md:top-1
37-
z-50
38-
w-full flex flex-col"
37+
class={`${position ?? "fixed"} m-auto
38+
top-0
39+
md:mx-2
40+
${isBlogPage ? "md:mt-1" : "md:top-1"}
41+
z-50
42+
w-full flex flex-col`}
3943
>
4044
<nav
4145
id="nav-bar"
@@ -173,7 +177,10 @@ const href = "#book-a-call-section";
173177

174178
{
175179
caseStudies.map((item) => (
176-
<a class="text-xl hover:text-white text-wrap min-h-8" href={item.href}>
180+
<a
181+
class="text-xl hover:text-white text-wrap min-h-8"
182+
href={item.href}
183+
>
177184
{item.title}
178185
</a>
179186
))
@@ -230,6 +237,8 @@ const href = "#book-a-call-section";
230237
const mobileList = document.getElementById("mobile-list");
231238
const navMenuToggle = document.getElementById("nav-menu-toggle");
232239

240+
const isBlogPage = window.location.pathname.startsWith("/blog");
241+
233242
mm.add("(width >= 768px)", () => {
234243
if (!navBar || !bookACallAction) return;
235244

@@ -246,6 +255,8 @@ const href = "#book-a-call-section";
246255
display: "none",
247256
});
248257

258+
if (isBlogPage) return;
259+
249260
const tl = gsap.timeline({
250261
paused: true,
251262
defaults: { duration: FRAME_DURATION, ease: "none" },

apps/website/src/layouts/base-blog.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Footer from "../components/footer.astro";
44
import Posthog from "../components/posthog.astro";
55
import "../styles/main.css";
66
import { AstroFont } from "astro-font";
7-
import BlogNavigation from "./blog-navigation.astro";
7+
import Navigation from "../components/navigation.astro";
88
99
const pf = theme.fonts.font_family.primary;
1010
const sf = theme.fonts.font_family.secondary;
@@ -56,7 +56,7 @@ if (theme.fonts.font_family.secondary) {
5656
/>
5757
</head>
5858
<body class="bg-body font-primary font-normal leading-relaxed text-text">
59-
<BlogNavigation />
59+
<Navigation position="none" />
6060
<main class="min-h-[60vh]">
6161
<slot />
6262
</main>

apps/website/src/layouts/blog-navigation.astro

Lines changed: 0 additions & 250 deletions
This file was deleted.

0 commit comments

Comments
 (0)