From ee66861ef16fa385c2db9fd1f315ba89e21404fc Mon Sep 17 00:00:00 2001 From: wass Date: Sat, 18 May 2024 16:02:10 +0200 Subject: [PATCH] fixed default gallery --- src/components/gallery/gallery.astro | 192 +++++++--------------- src/components/gallery/gallery.js | 84 +++------- src/components/gallery/gallery_grid.astro | 60 ------- src/components/gallery/gallery_pz.astro | 132 +++++++++++++++ src/components/gallery/gallery_pz.js | 62 +++++++ src/components/gallery/pswp_gallery.js | 22 --- src/components/markdown/code/Code.astro | 7 +- 7 files changed, 282 insertions(+), 277 deletions(-) delete mode 100644 src/components/gallery/gallery_grid.astro create mode 100644 src/components/gallery/gallery_pz.astro create mode 100644 src/components/gallery/gallery_pz.js delete mode 100644 src/components/gallery/pswp_gallery.js diff --git a/src/components/gallery/gallery.astro b/src/components/gallery/gallery.astro index 01af26c..70d8e3a 100644 --- a/src/components/gallery/gallery.astro +++ b/src/components/gallery/gallery.astro @@ -1,132 +1,60 @@ ---- -import {relAssetToUrl} from '@/libs/assets.js' -import {get_dir_files} from '@/libs/utils.js' -import PanZoomModal from '../panzoom/panzoommodal.astro' -import yaml from 'js-yaml' - -export interface Props { - code: string; - dirpath: string; - expanded: boolean; -} - -const { code, dirpath, expanded=true } = Astro.props as Props; - -let relImages -const data = yaml.load(code) -if(Array.isArray(data)){ - relImages = data -}else{ - if(Object.hasOwn(data,"dir")){ - relImages = await get_dir_files(dirpath,data.dir) - } -} - -let imagesUrls = [] -for(const relFile of relImages){ - const url = await relAssetToUrl(relFile,dirpath) - imagesUrls.push({ - url:url, - isSVG:url.endsWith(".svg"), - name:relFile - }) -} ---- - -