Skip to content

Commit b507536

Browse files
authored
feat: redesign Blog Navbar to match Landing Page (#659)
* feat: use Navigation instead Header component for blog page navigation * fix: edit /blog navbar header component to match CaseStudy and add gsap animations * fix: rename header component into blog-navigation * fix: check in navigation component if page location is /blog * fix: position static
1 parent 4e83749 commit b507536

File tree

3 files changed

+24
-148
lines changed

3 files changed

+24
-148
lines changed

apps/website/src/components/navigation.astro

Lines changed: 22 additions & 9 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,
@@ -25,15 +27,19 @@ const caseStudies = [
2527
href: "/blog/migrating-an-enterprise-app-from-angularjs-to-react",
2628
},
2729
];
30+
31+
const isBlogPage = Astro.url.pathname.startsWith("/blog");
32+
33+
const href = "#book-a-call-section";
2834
---
2935

3036
<header
31-
class="fixed m-auto
32-
top-0
33-
md:mx-2
34-
md:top-1
35-
z-50
36-
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`}
3743
>
3844
<nav
3945
id="nav-bar"
@@ -130,7 +136,7 @@ const caseStudies = [
130136
data-navhidden="true"
131137
id="book-a-call-action"
132138
class="invisible w-fit font-medium h-[39px] items-center px-4 py-2 rounded-md text-base text-center whitespace-nowrap bg-[#545664] text-[#ffffff] hover:opacity-90"
133-
href={"#book-a-call-section"}
139+
href={href}
134140
>
135141
Book a call
136142
</a>
@@ -171,7 +177,10 @@ const caseStudies = [
171177

172178
{
173179
caseStudies.map((item) => (
174-
<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+
>
175184
{item.title}
176185
</a>
177186
))
@@ -186,7 +195,7 @@ const caseStudies = [
186195
text-base text-center
187196
whitespace-nowrap
188197
bg-[#545664] text-[#ffffff] hover:opacity-90"
189-
href={"#book-a-call-section"}
198+
href={href}
190199
>
191200
Book a call
192201
</a>
@@ -228,6 +237,8 @@ const caseStudies = [
228237
const mobileList = document.getElementById("mobile-list");
229238
const navMenuToggle = document.getElementById("nav-menu-toggle");
230239

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

@@ -244,6 +255,8 @@ const caseStudies = [
244255
display: "none",
245256
});
246257

258+
if (isBlogPage) return;
259+
247260
const tl = gsap.timeline({
248261
paused: true,
249262
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
@@ -2,9 +2,9 @@
22
import theme from "../..//theme.json";
33
import Footer from "../components/footer.astro";
44
import Posthog from "../components/posthog.astro";
5-
import Header from "./header.astro";
65
import "../styles/main.css";
76
import { AstroFont } from "astro-font";
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-
<Header />
59+
<Navigation position="static" />
6060
<main class="min-h-[60vh]">
6161
<slot />
6262
</main>

apps/website/src/layouts/header.astro

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

0 commit comments

Comments
 (0)