Skip to content

Commit 5ba5754

Browse files
committed
improved ui of societree/clan page
1 parent 31609e1 commit 5ba5754

File tree

4 files changed

+61
-13
lines changed

4 files changed

+61
-13
lines changed

public/icons/arrow.svg

Lines changed: 13 additions & 0 deletions
Loading

src/assets/styles/card.css

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
:root {
2+
--highlight-bg: #ffb6c1;
3+
--highlight-text: #000;
4+
--accent: #f0a93b;
5+
}
6+
7+
@media (prefers-color-scheme: dark) {
8+
:root {
9+
--highlight-bg: #db7093;
10+
--highlight-text: #fff;
11+
}
12+
}
13+
114
.container__family {
215
background: var(--background);
316
min-height: 100vh;
@@ -74,6 +87,7 @@
7487
flex-direction: column;
7588
text-align: center;
7689
gap: 15px;
90+
padding: 1rem;
7791
}
7892

7993
& .open .card-info {
@@ -108,11 +122,19 @@
108122
}
109123

110124
& .back {
111-
background: var(--primary);
125+
background: #F0A93B url("/icons/arrow.svg") center/60% no-repeat;
126+
filter: invert(1);
127+
transform: rotate(-135deg);
128+
width: 2.2rem;
129+
height: 2.2rem;
112130
padding: 0.25rem 0.75rem;
113131
border-radius: 8px;
114132
}
115133

134+
& .card.open::before {
135+
display: none;
136+
}
137+
116138
& .card.open {
117139
grid-column: 1 / -1;
118140
width: 100%;
@@ -124,11 +146,14 @@
124146
overflow: visible;
125147
padding-bottom: 20px;
126148
margin-bottom: 1em;
127-
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
149+
border: var(--primary) 4px solid;
150+
border-top: 2px solid #f0e68c;
128151
}
129152

130153
& .card.open .card-body {
131154
display: block;
155+
background: color-mix(in srgb, var(--primary) 10%, transparent);
156+
border-radius: 20px;
132157
animation: fadeIn 0.3s ease-in;
133158
}
134159

@@ -152,6 +177,7 @@
152177
& .surname-heading {
153178
text-align: center;
154179
margin-bottom: 20px;
180+
color: var(--accent);
155181
}
156182

157183
& .surname-container {
@@ -236,7 +262,7 @@
236262
padding: 1em 1em;
237263
margin-bottom: 1em;
238264
display: flex;
239-
justify-content: center;
265+
justify-content: flex-start;
240266
background: var(--primary);
241267
color: var(--background);
242268
backdrop-filter: blur(10px);
@@ -275,6 +301,14 @@
275301
border-color: var(--accent);
276302
box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent);
277303
}
304+
305+
& .highlight {
306+
background: var(--highlight-bg);
307+
color: var(--highlight-text);
308+
padding: 0.25em 0.75em;
309+
border-radius: 0.5em;
310+
transition: background 0.3s ease, color 0.3s ease;
311+
}
278312
}
279313

280314
.icon {
@@ -343,7 +377,7 @@
343377
margin: 1em;
344378
}
345379

346-
& .surname-card > p {
380+
& .surname-card>p {
347381
text-align: left;
348382
}
349383

@@ -374,4 +408,4 @@
374408
font-size: 0.9em;
375409
}
376410
}
377-
}
411+
}

src/assets/styles/societree.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
.container__family {
22
& .hero {
33
display: flex;
4-
justify-content: space-around;
4+
justify-content: space-between;
55
align-items: center;
66
background: var(--primary);
77
color: var(--background);
88
text-align: center;
99
color: white;
10-
padding: 2rem 1rem 1rem;
10+
padding: 2rem 3rem;
11+
gap:1rem;
1112
}
1213

1314
& .theme-glass {
@@ -23,7 +24,7 @@
2324

2425
& .legend {
2526
display: flex;
26-
justify-content: center;
27+
justify-content: flex-start;
2728
gap: 2rem;
2829
flex-wrap: wrap;
2930
max-width: 600px;

src/components/Card.astro

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "@/assets/styles/card.css";
99
type="text"
1010
id="searchInput"
1111
class="search-bar theme-glass"
12-
placeholder="Search by Gotra, Deity, Caste, or Surname..."
12+
placeholder="Search by Gotra, Deity, Caste, or Surname... (in Hindi)"
1313
/>
1414
</div>
1515
</div>
@@ -43,7 +43,7 @@ import "@/assets/styles/card.css";
4343
function highlightText(text: string, query: string) {
4444
if (!query) return text;
4545
const regex = new RegExp(`(${query.trim()})`, "gi");
46-
return text.replace(regex, `<span style='background-color: yellow' class="highlight">$1</span>`);
46+
return text.replace(regex, `<span class="highlight">$1</span>`);
4747
}
4848

4949
function createKeyValuePairs(branch: Branch, query: string) {
@@ -97,7 +97,7 @@ import "@/assets/styles/card.css";
9797

9898
return `
9999
<div class="card-header">
100-
<button class="back">Back</button>
100+
<button class="back"></button>
101101
<button class="copy-button">
102102
<span class="icon"></span>
103103
</button>
@@ -118,8 +118,8 @@ import "@/assets/styles/card.css";
118118
</div>
119119
</div>
120120

121-
<div class="card-body">
122-
<h3>Surnames <span class="count">(${surnamesCount})</span></h3>
121+
<div class="card-body theme-glass">
122+
<h3 class="surname-heading">Surnames <span class="count">(${surnamesCount})</span></h3>
123123
<div class="surname-container">
124124
${surnamesHTML}
125125
</div>

0 commit comments

Comments
 (0)