From b2657962e1d0bc5a86cc9253b87853e77e8877fb Mon Sep 17 00:00:00 2001 From: June Date: Tue, 18 Nov 2025 12:51:59 +1300 Subject: [PATCH] Add much more responsible Swiper.JS image carousel over self-made one --- web/package-lock.json | 20 +++++ web/package.json | 1 + web/src/components/photos/carousel.astro | 109 +++++++++++++---------- web/src/pages/photos/index.astro | 4 +- 4 files changed, 85 insertions(+), 49 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index b314ed0..48bea90 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -12,6 +12,7 @@ "@tailwindcss/vite": "^4.1.17", "astro": "^5.15.4", "pocketbase": "^0.26.3", + "swiper": "^12.0.3", "tailwindcss": "^4.1.17" } }, @@ -4966,6 +4967,25 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/swiper": { + "version": "12.0.3", + "resolved": "https://registry.npmjs.org/swiper/-/swiper-12.0.3.tgz", + "integrity": "sha512-BHd6U1VPEIksrXlyXjMmRWO0onmdNPaTAFduzqR3pgjvi7KfmUCAm/0cj49u2D7B0zNjMw02TSeXfinC1hDCXg==", + "funding": [ + { + "type": "patreon", + "url": "https://www.patreon.com/swiperjs" + }, + { + "type": "open_collective", + "url": "http://opencollective.com/swiper" + } + ], + "license": "MIT", + "engines": { + "node": ">= 4.7.0" + } + }, "node_modules/tailwindcss": { "version": "4.1.17", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.17.tgz", diff --git a/web/package.json b/web/package.json index 86f31bc..1b0d368 100644 --- a/web/package.json +++ b/web/package.json @@ -13,6 +13,7 @@ "@tailwindcss/vite": "^4.1.17", "astro": "^5.15.4", "pocketbase": "^0.26.3", + "swiper": "^12.0.3", "tailwindcss": "^4.1.17" } } diff --git a/web/src/components/photos/carousel.astro b/web/src/components/photos/carousel.astro index d1e537e..1d6c3a5 100644 --- a/web/src/components/photos/carousel.astro +++ b/web/src/components/photos/carousel.astro @@ -8,66 +8,81 @@ const pb = await authPB() const photos = await pb.collection('photos').getFullList({ sort: '-created' }) - -const getImageLink = async (record: any) => { - return pb.files.getURL(record, record.image) -} --- - - - \ No newline at end of file + + +
+
+ {photos.map((photo) => ( +
+ {photo.title +
+ ))} +
+
\ No newline at end of file diff --git a/web/src/pages/photos/index.astro b/web/src/pages/photos/index.astro index 4cca51d..fda40fe 100644 --- a/web/src/pages/photos/index.astro +++ b/web/src/pages/photos/index.astro @@ -17,9 +17,9 @@ const photos = await pb.collection('photos').getFullList({

📸 {photos[0].camera}

📌 {photos[0].location}

- + of - +