Skip to content

Commit c6a4a07

Browse files
committed
added back button to state page and added cards to the hidenseek page
1 parent 2df8aa9 commit c6a4a07

File tree

9 files changed

+611
-136
lines changed

9 files changed

+611
-136
lines changed

src/assets/styles/capital.css

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -204,62 +204,73 @@
204204
opacity: 0.3;
205205
}
206206

207-
.location-card {
208-
& .location-details {
209-
display: flex;
210-
flex-direction: column;
211-
gap: 0.5rem;
212-
padding: 0.75rem 0;
213-
border-top: 1px solid rgba(255, 255, 255, 0.1);
207+
.location-card .location-details {
208+
display: flex;
209+
flex-direction: column;
210+
gap: 0.5rem;
211+
padding: 0.75rem 0;
212+
border-top: 1px solid rgba(255, 255, 255, 0.1);
213+
}
214214

215-
& .label {
216-
font-style: italic;
217-
color: light-dark(rgb(14, 62, 125), yellow);
218-
}
219-
}
215+
.location-card .location-details .label {
216+
font-style: italic;
217+
color: light-dark(rgb(14, 62, 125), yellow);
220218
}
221219

222220
/* Random card color variations */
223-
.location-card:nth-child(8n + 1) {
224-
background: var(--card-color-1);
221+
.location-card.color-card-color-1 {
222+
background-color: var(--card-color-1);
225223
color: white;
226224
}
227225

228-
.location-card:nth-child(8n + 2) {
229-
background: var(--card-color-2);
226+
.location-card.color-card-color-2 {
227+
background-color: var(--card-color-2);
230228
color: white;
231229
}
232230

233-
.location-card:nth-child(8n + 3) {
234-
background: var(--card-color-3);
231+
.location-card.color-card-color-3 {
232+
background-color: var(--card-color-3);
235233
color: white;
236234
}
237235

238-
.location-card:nth-child(8n + 4) {
239-
background: var(--card-color-4);
236+
.location-card.color-card-color-4 {
237+
background-color: var(--card-color-4);
240238
color: white;
241239
}
242240

243-
.location-card:nth-child(8n + 5) {
244-
background: var(--card-color-5);
241+
.location-card.color-card-color-5 {
242+
background-color: var(--card-color-5);
245243
color: white;
246244
}
247245

248-
.location-card:nth-child(8n + 6) {
249-
background: var(--card-color-6);
246+
.location-card.color-card-color-6 {
247+
background-color: var(--card-color-6);
250248
color: white;
251249
}
252250

253-
.location-card:nth-child(8n + 7) {
254-
background: var(--card-color-7);
251+
.location-card.color-card-color-7 {
252+
background-color: var(--card-color-7);
255253
color: white;
256254
}
257255

258-
.location-card:nth-child(8n + 8) {
259-
background: var(--card-color-8);
256+
.location-card.color-card-color-8 {
257+
background-color: var(--card-color-8);
260258
color: white;
261259
}
262260

261+
/* Remove the previous nth-child color selectors */
262+
.location-card:nth-child(8n + 1),
263+
.location-card:nth-child(8n + 2),
264+
.location-card:nth-child(8n + 3),
265+
.location-card:nth-child(8n + 4),
266+
.location-card:nth-child(8n + 5),
267+
.location-card:nth-child(8n + 6),
268+
.location-card:nth-child(8n + 7),
269+
.location-card:nth-child(8n + 8) {
270+
background-color: transparent;
271+
color: inherit;
272+
}
273+
263274
dialog#helpModal {
264275
border: none;
265276
border-radius: 10px;

src/assets/styles/map/state.css

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,37 @@
3838
box-shadow: var(--shadow-md);
3939
}
4040

41-
/* SVG Container (Left Side) */
4241
#state-svg-container {
4342
flex: 0.8;
44-
padding: calc(var(--spacing-unit) * 1);
43+
/*padding: calc(var(--spacing-unit) * 1);*/
4544
background-color: var(--secondary-bg);
4645
border-radius: 8px;
4746
box-shadow: var(--shadow-md);
47+
display: flex;
48+
flex-direction: column;
4849
}
4950

5051
#state-svg-container h3 {
51-
margin-bottom: calc(var(--spacing-unit) * 1.5);
52+
/*margin-bottom: calc(var(--spacing-unit) * 1);*/
5253
color: var(--primary-text);
5354
font-size: 1.5rem;
5455
text-align: center;
5556
}
5657

5758
#state-svg {
5859
width: 100%;
59-
height: auto;
60-
min-height: 300px;
60+
height: 50%; /* Change from min-height to height */
61+
flex-grow: 1; /* Allow it to grow and fill available space */
62+
display: flex;
63+
align-items: center;
64+
justify-content: center;
6165
}
6266

67+
#state-svg svg {
68+
max-width: 100%;
69+
max-height: 100%;
70+
object-fit: contain; /* Ensure the SVG fits within the container */
71+
}
6372
/* Right Content */
6473
.right-content {
6574
flex: 1.2;

src/components/Capitals.astro

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22
export interface Props {
33
stateList: any[];
44
utList: any[];
5-
// Removed colorPalette prop since we're now using CSS variables
6-
// Removed getContrastColor prop since we're using white text for all cards
75
}
86
97
import "@/assets/styles/capital.css";
108
119
const { stateList, utList } = Astro.props;
10+
11+
// Create a function to generate a color class based on index
12+
function getColorClass(index: number) {
13+
const colorClasses = [
14+
'card-color-1',
15+
'card-color-2',
16+
'card-color-3',
17+
'card-color-4',
18+
'card-color-5',
19+
'card-color-6',
20+
'card-color-7',
21+
'card-color-8'
22+
];
23+
return colorClasses[index % colorClasses.length];
24+
}
1225
---
1326

1427
<div class="geographical-mosaic">
@@ -43,8 +56,8 @@ const { stateList, utList } = Astro.props;
4356

4457
<div class="location-grid">
4558
{
46-
stateList.map((state) => (
47-
<div class="location-card">
59+
stateList.map((state, index) => (
60+
<div class={`location-card color-${getColorClass(index)}`}>
4861
<div class="card-inner">
4962
<h3 class="location-name">{state.name}</h3>
5063
<div class="location-details">
@@ -71,8 +84,8 @@ const { stateList, utList } = Astro.props;
7184

7285
<div class="location-grid">
7386
{
74-
utList.map((ut) => (
75-
<div class="location-card">
87+
utList.map((ut, index) => (
88+
<div class={`location-card color-${getColorClass(index)}`}>
7689
<div class="card-inner">
7790
<h3 class="location-name">{ut.name}</h3>
7891
<div class="location-details">
@@ -137,4 +150,4 @@ const { stateList, utList } = Astro.props;
137150
card.addEventListener("mouseenter", () => card.classList.add("hover-effect"));
138151
card.addEventListener("mouseleave", () => card.classList.remove("hover-effect"));
139152
});
140-
</script>
153+
</script>

src/components/Puzzle.astro

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
Shuffle
2929
</button>
3030
<button id="clearBtn" class="control-btn">
31-
<!--<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor">
32-
<path d="M19 7l-7 7-7-7" stroke-width="2" stroke-linecap="round"></path>
33-
</svg>-->
3431
Clear
3532
</button>
3633
<select id="difficultySelect" class="control-btn">
@@ -81,9 +78,9 @@
8178
// Changing the color generation for better visibility in help mode
8279
// Using more pastel colors with higher lightness and lower alpha
8380
const hue = Math.floor(Math.random() * 360); // Random hue (0-359)
84-
const saturation = 80 + Math.floor(Math.random() * 15); // 80-95% saturation
85-
const lightness = 70 + Math.floor(Math.random() * 15); // 70-85% lightness - lighter colors
86-
const alpha = 0.7; // Slightly more opaque for better distinction
81+
const saturation = 80 + Math.floor(Math.random() * 15);
82+
const lightness = 70 + Math.floor(Math.random() * 15);
83+
const alpha = 0.7;
8784
return `hsla(${hue}, ${saturation}%, ${lightness}%, ${alpha})`;
8885
}
8986

src/pages/capitals.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import Layout from "@/layouts/Base";
3-
import LocationMosaic from "../components/Capitals.astro";
4-
import { locations } from "../data/location.ts";
3+
import LocationMosaic from "@/components/Capitals.astro";
4+
import { locations } from "@/data/location.ts";
55
import Help from "@/components/Help.astro";
66
77
const meta = {

0 commit comments

Comments
 (0)