Skip to content

Commit 5ac5657

Browse files
committed
Added search icon to Zodiac cards
1 parent 884394e commit 5ac5657

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

public/js/main.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,6 @@ document.addEventListener("DOMContentLoaded", () => {
2828
document.getElementById("englishBtn")?.addEventListener("click", () => setLanguage("english"));
2929
document.getElementById("hindiBtn")?.addEventListener("click", () => setLanguage("hindi"));
3030

31-
// Dark mode
32-
const darkToggle = document.getElementById("darkModeToggle");
33-
if (localStorage.getItem("darkMode") === "enabled") {
34-
document.body.classList.add("dark-mode");
35-
if (darkToggle) darkToggle.checked = true;
36-
}
37-
darkToggle?.addEventListener("change", () => {
38-
const enabled = darkToggle.checked;
39-
document.body.classList.toggle("dark-mode", enabled);
40-
localStorage.setItem("darkMode", enabled ? "enabled" : "disabled");
41-
});
42-
4331
// Zodiac page logic
4432
if (window.location.pathname.includes("zodiac")) {
4533
fetch("/data/zodiacs.json")
@@ -52,8 +40,13 @@ document.addEventListener("DOMContentLoaded", () => {
5240
zodiacs.forEach((zodiac, i) => {
5341
const card = document.createElement("div");
5442
card.className = "card";
55-
card.innerHTML = `<h3>${zodiac.name[currentLang]}</h3><p>${zodiac.dates[currentLang]}</p>`;
56-
card.addEventListener("click", () => openModal(i));
43+
card.innerHTML = `
44+
<h3>${zodiac.name[currentLang]}</h3>
45+
<p>${zodiac.dates[currentLang]}</p>
46+
<button class="info-btn" title="Show Info" data-index="${i}">
47+
<span class="icon">🔍</span>
48+
</button>
49+
`;
5750
zodiacsGrid.appendChild(card);
5851
});
5952
}
@@ -78,6 +71,13 @@ document.addEventListener("DOMContentLoaded", () => {
7871
currentLang = localStorage.getItem("language") || "english";
7972
renderCards();
8073
});
74+
zodiacsGrid.addEventListener("click", (e) => {
75+
const btn = e.target.closest(".info-btn");
76+
if (btn) {
77+
const idx = btn.getAttribute("data-index");
78+
openModal(Number(idx));
79+
}
80+
});
8181
renderCards();
8282
});
8383
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ article {
8787
display: flex;
8888
flex-direction: column;
8989
justify-content: center;
90+
position: relative;
91+
/* max-height: 350px; */
9092
}
9193

9294
.card:hover {
@@ -246,3 +248,14 @@ article {
246248
}
247249

248250
}
251+
.info-btn {
252+
background: none;
253+
border: none;
254+
cursor: pointer;
255+
position: absolute;
256+
top: 0.5rem;
257+
right: 1rem;
258+
font-size: 1.2rem;
259+
color: var(--primary-color, #f12711);
260+
z-index: 2;
261+
}

src/pages/zodiac.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BaseLayout from "@/layouts/Base";
33
import Back from "@/components/Back.astro";
44
import ZodiacGrid from "@/components/ZodiacGrid.astro";
55
import Headers from "@/components/Header.astro";
6-
import "@/assets/styles/Sunsigns.css";
6+
import "@/assets/styles/zodiac.css";
77
---
88

99
<BaseLayout meta={{ title: "Nakshtra Nexus" }}>

src/utils/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ export const NavbarLinks: LinkProps[] = [
183183
isActive: true
184184
},
185185
{
186-
name: "Sunsigns",
187-
title: "Sunsigns",
186+
name: "Zodiac",
187+
title: "zodiac",
188188
path: "/zodiac",
189189
isActive: true
190190
},

0 commit comments

Comments
 (0)