From 8d543ab94d3678728466d3627e0d419ec00f3010 Mon Sep 17 00:00:00 2001 From: Zero~Informatique Date: Wed, 29 Jan 2020 04:53:35 +0100 Subject: viewer: finalized the thumbnails view layouts. implemented thumbnails lazy-loading --- viewer/src/@types/v-lazy-image.d.ts | 20 +++++++++++++++++++ viewer/src/assets/scss/global.scss | 36 +++++++++++++++++++++++++++++++++++ viewer/src/assets/scss/theme.scss | 4 ++++ viewer/src/main.ts | 1 + viewer/src/plugins/lazyimage.ts | 23 ++++++++++++++++++++++ viewer/src/views/GalleryDirectory.vue | 15 ++++++++------- viewer/src/views/GallerySearch.vue | 5 ++++- viewer/src/views/GalleryThumbnail.vue | 34 +++++++++++++++++++++++++++++++-- viewer/src/views/MainLayout.vue | 3 ++- 9 files changed, 130 insertions(+), 11 deletions(-) create mode 100644 viewer/src/@types/v-lazy-image.d.ts create mode 100644 viewer/src/plugins/lazyimage.ts (limited to 'viewer/src') diff --git a/viewer/src/@types/v-lazy-image.d.ts b/viewer/src/@types/v-lazy-image.d.ts new file mode 100644 index 0000000..e307751 --- /dev/null +++ b/viewer/src/@types/v-lazy-image.d.ts @@ -0,0 +1,20 @@ +/* ldgallery - A static generator which turns a collection of tagged +-- pictures into a searchable web gallery. +-- +-- Copyright (C) 2019-2020 Guillaume FOUET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +*/ + +declare module 'v-lazy-image'; \ No newline at end of file diff --git a/viewer/src/assets/scss/global.scss b/viewer/src/assets/scss/global.scss index 7afca8c..ff57775 100644 --- a/viewer/src/assets/scss/global.scss +++ b/viewer/src/assets/scss/global.scss @@ -18,6 +18,7 @@ */ // Global CSS +@import "@/assets/scss/theme.scss"; // === Forms @@ -42,3 +43,38 @@ .flex-center { align-items: center; } + +// === Scrollbar styling + +.scrollbar { + overflow-y: auto; +} +.scrollbar::-webkit-scrollbar { + width: 12px; +} +.scrollbar::-webkit-scrollbar-thumb { + box-shadow: inset 0 0 6px black; + background-color: $toolbar-color; +} + +// === Thumbnail tiles alignment + +.thumbnail-tiles { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + & > div { + margin: 1px; + } +} + +// === Effect to apply on lazy-image loading + +.v-lazy-image { + opacity: 0; + transition: opacity 0.4s; +} +.v-lazy-image-loaded { + opacity: 1; +} diff --git a/viewer/src/assets/scss/theme.scss b/viewer/src/assets/scss/theme.scss index 79e14e1..efd5d79 100644 --- a/viewer/src/assets/scss/theme.scss +++ b/viewer/src/assets/scss/theme.scss @@ -27,3 +27,7 @@ $panel-top-txtcolor: white; $panel-left-bgcolor: $panel-top-bgcolor; $panel-left-txtcolor: $panel-top-txtcolor; $content-bgcolor: #1e1e1e; + +$toolbar-color: #d62929; + +$loader-color: #119; diff --git a/viewer/src/main.ts b/viewer/src/main.ts index a5faa51..8e7716d 100644 --- a/viewer/src/main.ts +++ b/viewer/src/main.ts @@ -22,6 +22,7 @@ import "@/assets/scss/global.scss"; import "@/components" import "@/plugins/fontawesome"; import "@/plugins/buefy"; +import "@/plugins/lazyimage"; import store from '@/store' import i18n from "@/plugins/i18n"; import router from "@/router"; diff --git a/viewer/src/plugins/lazyimage.ts b/viewer/src/plugins/lazyimage.ts new file mode 100644 index 0000000..276c7e2 --- /dev/null +++ b/viewer/src/plugins/lazyimage.ts @@ -0,0 +1,23 @@ +/* ldgallery - A static generator which turns a collection of tagged +-- pictures into a searchable web gallery. +-- +-- Copyright (C) 2019-2020 Guillaume FOUET +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Affero General Public License for more details. +-- +-- You should have received a copy of the GNU Affero General Public License +-- along with this program. If not, see . +*/ + +import Vue from "vue"; +import { VLazyImagePlugin } from "v-lazy-image"; + +Vue.use(VLazyImagePlugin); diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue index eb98595..1df0c4d 100644 --- a/viewer/src/views/GalleryDirectory.vue +++ b/viewer/src/views/GalleryDirectory.vue @@ -18,13 +18,14 @@ --> diff --git a/viewer/src/views/GallerySearch.vue b/viewer/src/views/GallerySearch.vue index 7e61f89..870d3e2 100644 --- a/viewer/src/views/GallerySearch.vue +++ b/viewer/src/views/GallerySearch.vue @@ -18,13 +18,16 @@ --> diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue index 4d8f604..7ceea4f 100644 --- a/viewer/src/views/GalleryThumbnail.vue +++ b/viewer/src/views/GalleryThumbnail.vue @@ -18,8 +18,15 @@ -->