Skip to content

Commit 78e3911

Browse files
committed
refactor: update legend section title and improve layout styles for better alignment
1 parent 8e42b49 commit 78e3911

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

css/styles.css

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -535,13 +535,15 @@ body {
535535

536536
.legend-layers-section {
537537
padding: var(--space-md);
538+
display: flex;
539+
flex-direction: column;
540+
align-items: center;
538541
}
539542

540543
.legend-scale-section {
541544
padding: var(--space-sm) var(--space-md);
542545
display: flex;
543546
justify-content: center;
544-
border-top: 1px solid var(--glass-border);
545547
}
546548

547549
.legend-section-title {
@@ -551,31 +553,30 @@ body {
551553
text-transform: uppercase;
552554
letter-spacing: 0.8px;
553555
margin-bottom: var(--space-sm);
556+
text-align: center;
554557
}
555558

556559
.legend-items {
557560
display: flex;
558561
flex-direction: column;
559562
gap: var(--space-xs);
563+
align-items: center;
560564
}
561565

562566
.legend-item {
563567
display: flex;
564568
align-items: center;
565-
font-size: clamp(10px, 0.8vw, 12px);
569+
justify-content: center;
570+
font-size: clamp(12px, 1vw, 14px);
566571
color: var(--text-primary);
567-
padding: var(--space-sm) var(--space-md);
568-
background: rgba(255, 255, 255, 0.03);
569-
border: 1px solid rgba(255, 255, 255, 0.05);
570-
border-radius: var(--radius-sm);
572+
padding: var(--space-xs) 0;
571573
font-weight: 500;
572-
min-height: 32px;
574+
text-align: center;
573575
}
574576

575577
.legend-icon {
576578
width: 16px;
577579
height: 16px;
578-
margin-right: var(--space-sm);
579580
flex-shrink: 0;
580581
display: flex;
581582
align-items: center;
@@ -627,7 +628,6 @@ body {
627628
padding: var(--space-sm) var(--space-md);
628629
display: flex;
629630
justify-content: center;
630-
border-top: 1px solid var(--glass-border);
631631
}
632632

633633
.legend-controls {

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ <h2>Shelter Analysis</h2>
204204
<div class="map-legend-panel" id="mapLegendPanel">
205205
<!-- Data Layers Legend Section -->
206206
<div class="legend-layers-section">
207-
<div class="legend-section-title">Legend</div>
207+
<div class="legend-section-title">Legend & Layer Controls</div>
208208
<div class="legend-items" id="legend-items"></div>
209209
</div>
210210

js/app.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,7 @@ class ShelterAccessApp {
11521152

11531153
const legendItems = [];
11541154

1155-
// Building Footprints - always show when visible
1155+
// Always-on layers - Building Footprints and Existing Shelters
11561156
if (this.layerVisibility.buildings) {
11571157
legendItems.push({
11581158
type: 'color-box',
@@ -1163,7 +1163,6 @@ class ShelterAccessApp {
11631163
});
11641164
}
11651165

1166-
// Shelter layers - only when visible
11671166
if (this.layerVisibility.existingShelters) {
11681167
legendItems.push({
11691168
type: 'svg-icon',
@@ -1174,6 +1173,7 @@ class ShelterAccessApp {
11741173
});
11751174
}
11761175

1176+
// Optional layers - only when visible
11771177
if (this.layerVisibility.requestedShelters) {
11781178
legendItems.push({
11791179
type: 'svg-icon',
@@ -1218,14 +1218,14 @@ class ShelterAccessApp {
12181218
// Clear existing legend items
12191219
this.elements.legendItems.innerHTML = '';
12201220

1221-
// Only show legend if there are visible items
1221+
// Show legend section even if empty (it will just show the title)
1222+
this.elements.legendItems.style.display = 'block';
1223+
1224+
// Only add items if there are any
12221225
if (legendItems.length === 0) {
1223-
this.elements.legendItems.style.display = 'none';
12241226
return;
12251227
}
12261228

1227-
this.elements.legendItems.style.display = 'block';
1228-
12291229
// Add new legend items with proper symbology
12301230
legendItems.forEach(item => {
12311231
const legendItem = document.createElement('div');

0 commit comments

Comments
 (0)