Skip to content

Commit 42a750f

Browse files
committed
disable lightbox, add copyright notice
Signed-off-by: rishichawda <rishichawda@users.noreply.github.com>
1 parent 4cf75fc commit 42a750f

File tree

3 files changed

+177
-65
lines changed

3 files changed

+177
-65
lines changed

src/components/gallery/gallery_grid.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ const processing = false;
3737
</div>
3838
)
3939
}
40+
4041
</div>

src/pages/gallery/[slug].astro

Lines changed: 103 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
import BaseLayout from "../../layouts/base_layout.astro";
33
import "../../styles/global.css";
4-
import Lightbox from "../../components/gallery/lightbox.astro";
4+
// Remove Lightbox import
5+
// import Lightbox from "../../components/gallery/lightbox.astro";
56
import { getCollection } from "astro:content";
67
import { Image } from "astro:assets";
78
import { Schema } from "astro-seo-schema";
@@ -10,8 +11,14 @@ import masonry from "masonry-layout/dist/masonry.pkgd.min?url";
1011
import imagesloaded from "imagesloaded/imagesloaded.pkgd.min?url";
1112
1213
// Define interfaces needed for profile data
13-
interface Social { platform: string; url: string; }
14-
interface ProfileData { name: string; socials: Social[]; /* Add other fields if needed */ }
14+
interface Social {
15+
platform: string;
16+
url: string;
17+
}
18+
interface ProfileData {
19+
name: string;
20+
socials: Social[] /* Add other fields if needed */;
21+
}
1522
1623
// Fetch profile data
1724
const profileEntry = await getCollection("profile");
@@ -27,22 +34,28 @@ export async function getStaticPaths() {
2734
2835
const { gallery } = Astro.props;
2936
30-
const { title, description, featured_image, tags, images: unsortedImages } =
31-
gallery.data;
37+
const {
38+
title,
39+
description,
40+
featured_image,
41+
tags,
42+
images: unsortedImages,
43+
} = gallery.data;
3244
3345
// Sort images: featured image first, then by date (newest first)
34-
const images = unsortedImages?.sort((a, b) => {
35-
const isAFeatured = a.src.src === featured_image.src; // Compare source paths
36-
const isBFeatured = b.src.src === featured_image.src; // Compare source paths
46+
const images =
47+
unsortedImages?.sort((a, b) => {
48+
const isAFeatured = a.src.src === featured_image.src; // Compare source paths
49+
const isBFeatured = b.src.src === featured_image.src; // Compare source paths
3750
38-
if (isAFeatured) return -1; // a comes first
39-
if (isBFeatured) return 1; // b comes first
51+
if (isAFeatured) return -1; // a comes first
52+
if (isBFeatured) return 1; // b comes first
4053
41-
// If neither is featured, sort by date descending
42-
const dateA = a.date ? new Date(a.date) : new Date(0);
43-
const dateB = b.date ? new Date(b.date) : new Date(0);
44-
return dateB.getTime() - dateA.getTime();
45-
}) || [];
54+
// If neither is featured, sort by date descending
55+
const dateA = a.date ? new Date(a.date) : new Date(0);
56+
const dateB = b.date ? new Date(b.date) : new Date(0);
57+
return dateB.getTime() - dateA.getTime();
58+
}) || [];
4659
4760
const page_info = {
4861
title: `${title} - ${profile.name}`, // Use profile name
@@ -101,7 +114,8 @@ const pageUrl = new URL(
101114
<main
102115
class="font-['Red_Hat_Display_Variable'] min-h-screen bg-gray-50 dark:bg-gray-900"
103116
>
104-
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 sm:py-20"> {/* Adjusted padding */}
117+
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-16 sm:py-20">
118+
{/* Adjusted padding */}
105119
<a
106120
href="/gallery/"
107121
class="inline-flex items-center text-brand-700 dark:text-brand-300 hover:text-brand-900 dark:hover:text-brand-100 mb-12 sm:mb-16 group text-sm tracking-widest uppercase transition-colors duration-300 font-medium"
@@ -122,7 +136,8 @@ const pageUrl = new URL(
122136
Back to Gallery
123137
</a>
124138

125-
<div class="max-w-3xl mx-auto text-center mb-16 sm:mb-20"> {/* Adjusted margin */}
139+
<div class="max-w-3xl mx-auto text-center mb-16 sm:mb-20">
140+
{/* Adjusted margin */}
126141
<h1
127142
transition:name={`${gallery.id}-title`}
128143
class="text-4xl sm:text-5xl lg:text-6xl font-light text-brand-900 dark:text-white mb-6 sm:mb-8 tracking-tight leading-tight"
@@ -137,7 +152,9 @@ const pageUrl = new URL(
137152
</p>
138153
{
139154
tags && tags.length > 0 && (
140-
<div class="flex flex-wrap gap-2 sm:gap-3 justify-center mt-8 sm:mt-10"> {/* Adjusted gap and margin */}
155+
<div class="flex flex-wrap gap-2 sm:gap-3 justify-center mt-8 sm:mt-10">
156+
{" "}
157+
{/* Adjusted gap and margin */}
141158
{tags.map((tag) => (
142159
<span
143160
transition:name={`${gallery.id}-${tag}`}
@@ -150,12 +167,33 @@ const pageUrl = new URL(
150167
)
151168
}
152169
</div>
170+
<div
171+
class="mt-6 flex items-start p-4 rounded-lg bg-brand-100/[0.5] dark:bg-brand-900/30 border border-brand-200 dark:border-brand-700/50 mx-auto shadow-sm"
172+
>
173+
<svg
174+
xmlns="http://www.w3.org/2000/svg"
175+
class="h-5 w-5 text-brand-700 dark:text-brand-400 flex-shrink-0 mr-3 mt-0.5"
176+
viewBox="0 0 20 20"
177+
fill="currentColor"
178+
>
179+
<path
180+
fill-rule="evenodd"
181+
d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
182+
clip-rule="evenodd"></path>
183+
</svg>
184+
<p class="text-sm text-brand-800 dark:text-brand-200">
185+
<strong class="font-medium">Heads up!</strong> I'm currently sorting through
186+
and uploading lots of new photos to this gallery. It's a slow process,
187+
but please feel free to check back often to see the latest additions. Enjoy
188+
the photos that have been uploaded so far!
189+
</p>
190+
</div>
153191

154192
{/* Masonry Grid Container */}
155-
<div id="masonry-grid" class="relative py-4">
193+
<div id="masonry-grid" class="relative py-4">
156194
{
157195
images.map((image, index) => (
158-
<div class="grid-item group relative aspect-auto overflow-hidden rounded-lg shadow-md hover:shadow-xl transition-shadow duration-300 mb-4 sm:mb-6">
196+
<div class="grid-item group relative aspect-auto overflow-hidden rounded-lg shadow-md hover:shadow-xl transition-shadow duration-300 mb-4 sm:mb-6">
159197
<Image
160198
src={image.src}
161199
alt={image.alt || `${title} photo ${index + 1}`}
@@ -164,6 +202,8 @@ const pageUrl = new URL(
164202
widths={[400, 800, 1200]}
165203
sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
166204
/>
205+
{/* Remove the overlay div and button that triggered the lightbox */}
206+
{/*
167207
<div class="absolute inset-0 bg-gradient-to-t from-black/60 via-black/20 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex items-center justify-center">
168208
<button
169209
class="text-white p-3 rounded-full bg-black/40 hover:bg-black/60 transition-all duration-300 transform scale-75 opacity-0 group-hover:scale-100 group-hover:opacity-100 hover:scale-110 shadow-lg backdrop-blur-sm"
@@ -185,53 +225,67 @@ const pageUrl = new URL(
185225
/>
186226
</svg>
187227
</button>
188-
</div>
228+
</div>
229+
*/}
189230
</div>
190231
))
191232
}
192233
</div>
234+
235+
{/* Copyright Notice */}
236+
<p
237+
class="text-center text-xs sm:text-sm text-gray-500 dark:text-gray-400 mt-12 sm:mt-16 font-light"
238+
>
239+
All photographs displayed in this gallery are the intellectual property
240+
of {profile.name}. Any reproduction, distribution, or use of these
241+
images, in whole or in part, without explicit written permission from
242+
the copyright holder is strictly prohibited.
243+
</p>
193244
</div>
194245
</main>
195-
<Lightbox />
246+
{/* Remove Lightbox component instance */}
247+
{/* <Lightbox /> */}
196248

197249
{/* Add Masonry library script */}
198250
<script src={masonry} is:inline></script>
199251
{/* Add imagesLoaded library script for better layout handling */}
200252
<script src={imagesloaded} is:inline></script>
201253

202254
<script is:inline>
203-
document.addEventListener('astro:page-load', () => {
204-
const grid = document.querySelector('#masonry-grid');
255+
document.addEventListener("astro:page-load", () => {
256+
const grid = document.querySelector("#masonry-grid");
205257
if (grid) {
206258
// Initialize imagesLoaded
207259
const imgLoad = imagesLoaded(grid);
208-
260+
209261
// Initialize Masonry after images have loaded
210-
imgLoad.on('always', function() {
262+
imgLoad.on("always", function () {
211263
const msnry = new Masonry(grid, {
212-
itemSelector: '.grid-item',
264+
itemSelector: ".grid-item",
213265
// Use columnWidth to help Masonry calculate positioning, especially useful for responsive layouts
214266
// This selector targets the items themselves to determine width
215-
columnWidth: '.grid-item',
267+
columnWidth: ".grid-item",
216268
percentPosition: true,
217-
gutter: 16 // Set gutter based on desired base spacing (e.g., 1rem = 16px)
269+
gutter: 16, // Set gutter based on desired base spacing (e.g., 1rem = 16px)
218270
});
219271

220272
// Recalculate gutter on resize if needed (optional, depends on design)
221-
window.addEventListener('resize', () => {
273+
window.addEventListener("resize", () => {
222274
// Example: Adjust gutter based on viewport width
223275
let newGutter = 16; // Default 1rem
224-
if (window.innerWidth >= 640 && window.innerWidth < 1024) { // sm to lg
276+
if (window.innerWidth >= 640 && window.innerWidth < 1024) {
277+
// sm to lg
225278
newGutter = 24; // 1.5rem
226-
} else if (window.innerWidth >= 1024) { // lg and up
279+
} else if (window.innerWidth >= 1024) {
280+
// lg and up
227281
newGutter = 24; // 1.5rem
228282
}
229283
msnry.options.gutter = newGutter;
230284
msnry.layout(); // Re-layout Masonry with the new gutter
231285
});
232-
286+
233287
// Initial layout might need a slight delay or re-layout after styles apply
234-
setTimeout(() => msnry.layout(), 100);
288+
setTimeout(() => msnry.layout(), 100);
235289
});
236290
}
237291
});
@@ -246,30 +300,36 @@ const pageUrl = new URL(
246300
margin-bottom: 1rem; /* Vertical spacing (gap-4) */
247301
}
248302

249-
@media (min-width: 640px) { /* sm breakpoint */
303+
@media (min-width: 640px) {
304+
/* sm breakpoint */
250305
.grid-item {
251306
width: calc(50% - 8px); /* 50% width minus half the gutter (16px / 2) */
252307
margin-bottom: 1.5rem; /* Vertical spacing (sm:gap-6) */
253308
}
254309
/* Adjust width if gutter changes */
255310
@media (min-width: 640px) and (max-width: 1023px) {
256-
.grid-item {
257-
width: calc(50% - 12px); /* Half of 24px gutter */
258-
}
311+
.grid-item {
312+
width: calc(50% - 12px); /* Half of 24px gutter */
313+
}
259314
}
260315
}
261316

262-
@media (min-width: 1024px) { /* lg breakpoint */
317+
@media (min-width: 1024px) {
318+
/* lg breakpoint */
263319
.grid-item {
264-
width: calc(33.333% - 16px * 2 / 3); /* 33.333% width minus two-thirds of the gutter (16px * 2/3) */
320+
width: calc(
321+
33.333% - 16px * 2 / 3
322+
); /* 33.333% width minus two-thirds of the gutter (16px * 2/3) */
265323
/* If gutter is 24px at this breakpoint: */
266-
width: calc(33.333% - 16px); /* 33.333% width minus two-thirds of the gutter (24px * 2/3) */
267-
margin-bottom: 1.5rem; /* Vertical spacing (lg:gap-6) */
324+
width: calc(
325+
33.333% - 16px
326+
); /* 33.333% width minus two-thirds of the gutter (24px * 2/3) */
327+
margin-bottom: 1.5rem; /* Vertical spacing (lg:gap-6) */
268328
}
269329
}
270330

271331
/* Remove negative margins previously used for gutter simulation */
272332
#masonry-grid {
273-
margin: 0;
333+
margin: 0;
274334
}
275335
</style>

0 commit comments

Comments
 (0)