Skip to content

Commit 3cbc0b6

Browse files
ivke995gloriababic
andauthored
Feat: add Case Study Menu (#629)
* feat: create Menu and MenuItem components for Case Study navbar list item * fix: fix nav width * feat: add mobile design Co-authored-by: Gloria Babic <gloria@crocoder.dev>
1 parent 81ec3a9 commit 3cbc0b6

4 files changed

Lines changed: 72 additions & 5 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
import classNames from "classnames";
3+
import ChevronTop from "./icons/ChevronTop.astro";
4+
5+
interface Props {
6+
className?: string;
7+
title: string;
8+
}
9+
10+
const { className, title } = Astro.props;
11+
---
12+
13+
<div class={classNames("relative group flex gap-2 items-center", className)}>
14+
<div class="hidden group-hover:grid z-10 absolute">
15+
<div
16+
class="bg-[#3C3843E5] min-w-56 mt-[214px] p-4 gap-2.5 grid rounded-lg"
17+
>
18+
<slot />
19+
</div>
20+
</div>
21+
<button
22+
class="whitespace-nowrap font-medium text-2xl md:text-lg text-[#E8E8E8] hover:text-white"
23+
>{title}</button
24+
>
25+
<ChevronTop classNames="group-hover:rotate-180" />
26+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="whitespace-nowrap font-medium text-2xl md:text-lg text-[#E8E8E8] hover:text-white">
2+
<slot />
3+
</div>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
import type { HTMLAttributes } from "astro/types";
3+
import classnames from "classnames";
4+
5+
type Props = HTMLAttributes<"svg"> & { classNames?: string };
6+
7+
const { classNames } = Astro.props;
8+
---
9+
10+
<svg
11+
xmlns="http://www.w3.org/2000/svg"
12+
width="16"
13+
height="17"
14+
viewBox="0 0 16 17"
15+
fill="none"
16+
class={classnames(classNames)}
17+
>
18+
<path
19+
d="M1.13571 11.8273L7.63038 5.33266C7.67779 5.28215 7.73504 5.24189 7.79862 5.21437C7.86219 5.18685 7.93073 5.17265 8 5.17265C8.06927 5.17265 8.13781 5.18685 8.20138 5.21437C8.26495 5.24189 8.32221 5.28215 8.36961 5.33266L14.8643 11.8273"
20+
stroke="white"
21+
stroke-width="1.5"
22+
stroke-linecap="round"
23+
stroke-linejoin="round"></path>
24+
</svg>

apps/website/src/components/navigation.astro

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
import { getImage } from "astro:assets";
33
import crocoderLogo from "../assets/crocoder-logo.png";
4+
import Menu from "./Menu.astro";
5+
import MenuItem from "./MenuItem.astro";
46
57
const optimizedLogo = await getImage({
68
src: crocoderLogo,
@@ -31,9 +33,8 @@ const optimizedLogo = await getImage({
3133
md:px-[15px]
3234
md:rounded-l-[3rem]
3335
md:rounded-r-lg
34-
md:overflow-hidden
3536
relative
36-
md:w-[680px]"
37+
md:w-[780px]"
3738
data-navhidden="false"
3839
>
3940
<a
@@ -98,6 +99,13 @@ const optimizedLogo = await getImage({
9899
Blog
99100
</a>
100101
</li>
102+
<li id="case-study" data-navhidden="true" class="m-2">
103+
<Menu title={"Case Studies"}>
104+
<MenuItem><a href="/blog/how-we-rebuilt-a-legacy-ui-with-zero-downtime">Legacy UI</a></MenuItem>
105+
<MenuItem><a href="/blog/using-lago-to-create-a-flexible-billing-system">Billing System</a></MenuItem>
106+
<MenuItem><a href="/blog/migrating-an-enterprise-app-from-angularjs-to-react">Frontend Migration</a></MenuItem>
107+
</Menu>
108+
</li>
101109
<li id="book-a-call-container" class="ml-auto pr-2">
102110
<a
103111
data-navhidden="true"
@@ -137,6 +145,12 @@ const optimizedLogo = await getImage({
137145
>
138146
Blog
139147
</a>
148+
<div class="whitespace-nowrap flex flex-col gap-3 font-medium text-2xl md:text-lg text-[#E8E8E8] hover:text-white min-h-10 items-center">
149+
Case Studies
150+
<a class="text-xl" href="/blog/how-we-rebuilt-a-legacy-ui-with-zero-downtime">Legacy UI</a>
151+
<a class="text-xl" href="/blog/using-lago-to-create-a-flexible-billing-system">Billing System</a>
152+
<a class="text-xl" href="/blog/migrating-an-enterprise-app-from-angularjs-to-react">Frontend Migration</a>
153+
</div>
140154
<a
141155
data-navhidden="true"
142156
id="mobile-book-a-call-action"
@@ -170,13 +184,14 @@ const optimizedLogo = await getImage({
170184
let mm = gsap.matchMedia();
171185

172186
const NAV_SHRINK_WIDTH = "377px";
173-
const NAV_EXPAND_WIDTH = "680px";
187+
const NAV_EXPAND_WIDTH = "780px";
174188
const FRAME_DURATION = 0.425;
175189

176190
const navBar = document.getElementById("nav-bar");
177191
const logoElem = document.getElementById("logo");
178192
const forCtoElem = document.getElementById("for-ctos");
179193
const blogElem = document.getElementById("blog");
194+
const caseStudyElem = document.getElementById("case-study");
180195
const bookACallAction = document.getElementById("book-a-call-action");
181196
const containerElement = document.getElementById("book-a-call-container");
182197
const mobileBookACallAction = document.getElementById(
@@ -190,12 +205,11 @@ const optimizedLogo = await getImage({
190205
mm.add("(width >= 768px)", () => {
191206
if (!navBar || !bookACallAction) return;
192207

193-
const navHideItems = [forCtoElem, blogElem, logoElem];
208+
const navHideItems = [forCtoElem, blogElem, logoElem, caseStudyElem];
194209

195210
gsap.set(navBar, { width: NAV_EXPAND_WIDTH, overwrite: false });
196211
gsap.set(navHideItems, {
197212
autoAlpha: 1,
198-
overflow: "hidden",
199213
});
200214
gsap.set(containerElement, { autoAlpha: 0 });
201215
gsap.set(bookACallAction, {

0 commit comments

Comments
 (0)