Skip to content

Commit 20d0eee

Browse files
authored
Fix: Navigation Text Logo style and href (#576)
* fix: nav href and text logo style - check if pathname is /contact * fix: nav href and text logo style - remove HTML attributes height and width * fix: nav href and text logo style - change width of text logo * fix: nav href and text logo style - navigation width increased and important auto width * fix: nav href and text logo style - add tailwind md breakpoint for hidden attribute
1 parent 9e381de commit 20d0eee

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

apps/website/src/components/navigation.astro

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const optimizedLogo = await getImage({
99
height: 51,
1010
format: "webp",
1111
});
12+
13+
const isContact = Astro.url.pathname === "/contact"
1214
---
1315

1416
<header
@@ -36,7 +38,7 @@ const optimizedLogo = await getImage({
3638
relative
3739
gap:12
3840
max-md:has-[input:checked]:bg-secondary
39-
md:w-[600px]"
41+
md:w-[680px]"
4042
data-navhidden="false"
4143
>
4244
<a
@@ -47,18 +49,14 @@ const optimizedLogo = await getImage({
4749
<img
4850
src={optimizedLogo.src}
4951
alt="Crocoder Crocodile Logo"
50-
width="63"
51-
height="51"
5252
class="h-[51px] w-auto"
5353
loading="eager"
5454
/>
5555
<img
5656
id="logo"
57-
width={153}
58-
height={24}
5957
alt="Crocoder Text Logo"
6058
src="/images/crocoder-text.svg"
61-
class="pl-[14px] h-6 w-auto hidden md:flex"
59+
class="pl-[14px] h-6 w-[154px] hidden md:flex"
6260
data-navhidden="false"
6361
/>
6462
</a>
@@ -110,8 +108,8 @@ const optimizedLogo = await getImage({
110108
data-navhidden="true"
111109
id="book-a-call-action"
112110
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"
113-
href="/#book-a-call-section"
114-
>
111+
href={isContact ? "/#book-a-call-section" : "#book-a-call-section"}
112+
>
115113
Book a call
116114
</a>
117115
</li>
@@ -153,7 +151,8 @@ const optimizedLogo = await getImage({
153151
text-base text-center
154152
whitespace-nowrap
155153
bg-[#545664] text-[#ffffff] hover:opacity-90"
156-
href="/#book-a-call-section">Book a call</a
154+
href={isContact ? "/#book-a-call-section" : "#book-a-call-section"}
155+
>Book a call</a
157156
>
158157
<a
159158
class="font-medium
@@ -203,8 +202,7 @@ const optimizedLogo = await getImage({
203202
classes are added first time the handle scroll is triggered*/
204203
if (!navElem.classList.contains("animated-navigation")) {
205204
navElem.classList.add("animated-navigation");
206-
navElem.classList.remove("md:w-[600px]");
207-
logoElem.classList.add("animated-button");
205+
navElem.classList.remove("md:w-[680px]");
208206
forCtoElem.classList.add("animated-text");
209207
blogElem.classList.add("animated-text");
210208
bookACallAction.classList.add("animated-button", "w-fit");
@@ -250,8 +248,8 @@ const optimizedLogo = await getImage({
250248
switch (node.getAttribute("id")) {
251249
case "logo":
252250
condition = node.getAttribute("data-navhidden") === "false";
253-
logoElem.classList.toggle("hidden", condition);
254-
logoElem.classList.toggle("!w-0", condition);
251+
logoElem.classList.toggle("md:hidden", condition);
252+
logoElem.classList.toggle("w-0", condition);
255253
break;
256254
case "for-ctos":
257255
condition = node.getAttribute("data-navhidden") === "true";

apps/website/src/styles/navigation.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@keyframes navigation-animation {
22
0% {
3-
width: 600px;
3+
width: 680px;
44
}
55

66
100% {
@@ -130,9 +130,12 @@
130130
animation-direction: normal;
131131
}
132132

133-
.animated-button,
133+
.animated-button {
134+
animation-name: visible-animation;
135+
}
136+
134137
.animated-text {
135138
width: auto !important;
136139
animation-name: visible-animation;
137140
}
138-
}
141+
}

0 commit comments

Comments
 (0)