Skip to content

Commit 93aaf8b

Browse files
committed
style: redesign beer-themed map popups and update featured pub card styling
1 parent 7d0c2e0 commit 93aaf8b

2 files changed

Lines changed: 34 additions & 23 deletions

File tree

app/views/index.pug

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ block content
2121
each pub in featuredPubs
2222
section.w-third.remove-styling
2323
div.beer-item(style="text-align: left; padding: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; height: 100%; box-sizing: border-box; overflow: hidden;")
24-
img(src="/static/images/pub-placeholder.png", alt="Featured Pub", style="width: 100%; height: 180px; object-fit: cover; border-radius: 8px 8px 0 0;")
24+
- var lightness1 = 35 + (pub.id * 17) % 25
25+
- var lightness2 = 20 + (pub.id * 13) % 20
26+
- var bgStyle = `background: linear-gradient(135deg, hsl(29, 60%, ${lightness1}%), hsl(29, 70%, ${lightness2}%));`
27+
div(style=`${bgStyle} width: 100%; height: 180px; display: flex; align-items: center; justify-content: center;`)
28+
i.fa-solid.fa-beer-mug-empty(style="font-size: 5em; color: rgba(255, 255, 255, 0.5);")
2529
div(style="padding: 20px; display: flex; flex-direction: column; align-items: flex-start; flex-grow: 1; width: 100%; box-sizing: border-box;")
2630
strong(style="display: block; font-size: 1.3em; margin-bottom: 10px;") #{pub.name}
2731
p(style="margin: 5px 0 10px 0; color: #555;") #[i.fa-solid.fa-location-dot(style="margin-right: 6px;")] #{pub.address}

static/maps.js

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ function initMap(pubs) {
9696

9797
const beerIcon = L.icon({
9898
iconUrl: 'data:image/svg+xml;base64,' + btoa(beerSVG),
99-
iconSize: [26, 32],
100-
iconAnchor: [13, 32],
101-
popupAnchor: [0, -32]
99+
iconSize: [26, 32],
100+
iconAnchor: [13, 32],
101+
popupAnchor: [0, -32]
102102
});
103103

104104
// Beer-themed popup CSS
@@ -124,40 +124,43 @@ function initMap(pubs) {
124124
padding: 12px 16px;
125125
font-size: 18px;
126126
font-weight: bold;
127-
border-bottom: 4px solid #f4c95d;
127+
border-bottom: 4px solid #b87334;
128128
text-align: center;
129+
font-family: 'Instrument Serif', serif;
129130
}
130131
131132
/* Golden beer body */
132133
.beer-popup .popup-body {
133-
background: #FFCC00;
134-
color: #2c3e50;
134+
background: #b87334;
135+
color: #fff;
135136
padding: 14px 16px;
136137
line-height: 1.6;
138+
font-family: 'Inter', sans-serif;
137139
}
138140
139141
.beer-popup .popup-body a {
140-
color: #2c3e50;
142+
color: #fff;
141143
font-weight: bold;
142-
text-decoration: underline;
144+
text-decoration: none;
143145
}
144146
145147
.beer-popup .popup-body a:hover {
146148
color: #1a252f;
147149
}
148150
149151
.beer-popup .leaflet-popup-tip {
150-
background: #FFCC00;
152+
background: #b87334;
151153
}
154+
152155
`;
153-
document.head.appendChild(style);
156+
document.head.appendChild(style);
154157

155158
const markers = [];
156159
pubs.forEach(pub => {
157160
let reviewHTML = `<em>No reviews yet</em>`;
158161

159162
if (pub.comment) {
160-
reviewHTML = `
163+
reviewHTML = `
161164
<strong>Latest Review:</strong><br>
162165
Rating: ${pub.rating}/5<br>
163166
${pub.ai_pour_score ? `AI Score: ${pub.ai_pour_score}<br>` : ""}
@@ -171,44 +174,48 @@ function initMap(pubs) {
171174
${pub.name}
172175
</div>
173176
<div class="popup-body">
174-
${pub.address}, ${pub.postcode}<br><br>
175-
176-
${reviewHTML}<br><br>
177+
<p style="margin: 0 0 15px 0;">${pub.address}, ${pub.postcode}</p>
178+
<div style="margin-bottom: 20px;">
179+
${reviewHTML}
180+
</div>
177181
178-
<a href="/pubs/${pub.id}">View Pub Details →</a>
182+
<div style="display: flex; flex-direction: row; gap: 10px; justify-content: space-between;">
183+
<a class="btn" style="flex: 1; text-align: center; padding: 12px 0; font-size: 1em; font-weight: bold; margin: 0 15px 0 5px;" href="/pubs/${pub.id}">Details</a>
184+
<a class="btn" style="flex: 1; text-align: center; padding: 12px 0; font-size: 1em; font-weight: bold; margin: 0 5px 0 5px;" href="/map?pub_id=${pub.id}">Directions</a>
185+
</div>
179186
</div>
180187
</div>
181188
`;
182189

183-
const marker = L.marker([pub.latitude, pub.longitude], {
184-
icon: beerIcon
190+
const marker = L.marker([pub.latitude, pub.longitude], {
191+
icon: beerIcon
185192
})
186193
.addTo(map)
187194
.bindPopup(popupHTML, {
188-
className: 'beer-popup',
195+
className: 'beer-popup',
189196
closeButton: true,
190197
maxWidth: 280
191198
});
192-
199+
193200
markers.push(marker);
194201
});
195202

196203
const urlParams = new URLSearchParams(window.location.search);
197204
const searchQuery = urlParams.get('search');
198-
205+
199206
if (searchQuery) {
200207
const searchInput = document.getElementById('mapSearchInput');
201208
if (searchInput) {
202209
searchInput.value = searchQuery;
203210
}
204-
211+
205212
const overlay = document.getElementById('searchOverlay');
206213
const overlayText = document.getElementById('searchOverlayText');
207214
if (overlay && overlayText) {
208215
overlayText.textContent = `Showing ${pubs.length} result${pubs.length === 1 ? '' : 's'} for "${searchQuery}"`;
209216
overlay.style.display = 'flex';
210217
}
211-
218+
212219
if (markers.length > 0) {
213220
const group = L.featureGroup(markers);
214221
map.fitBounds(group.getBounds(), { padding: [50, 50], maxZoom: 16 });

0 commit comments

Comments
 (0)