diff options
Diffstat (limited to 'viewer/src/components/LdBreadcrumb.vue')
-rw-r--r-- | viewer/src/components/LdBreadcrumb.vue | 127 |
1 files changed, 0 insertions, 127 deletions
diff --git a/viewer/src/components/LdBreadcrumb.vue b/viewer/src/components/LdBreadcrumb.vue deleted file mode 100644 index 618b15a..0000000 --- a/viewer/src/components/LdBreadcrumb.vue +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | <!-- ldgallery - A static generator which turns a collection of tagged | ||
2 | -- pictures into a searchable web gallery. | ||
3 | -- | ||
4 | -- Copyright (C) 2019-2020 Guillaume FOUET | ||
5 | -- | ||
6 | -- This program is free software: you can redistribute it and/or modify | ||
7 | -- it under the terms of the GNU Affero General Public License as | ||
8 | -- published by the Free Software Foundation, either version 3 of the | ||
9 | -- License, or (at your option) any later version. | ||
10 | -- | ||
11 | -- This program is distributed in the hope that it will be useful, | ||
12 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | -- GNU Affero General Public License for more details. | ||
15 | -- | ||
16 | -- You should have received a copy of the GNU Affero General Public License | ||
17 | -- along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
18 | --> | ||
19 | |||
20 | <template> | ||
21 | <div | ||
22 | ref="breadcrumb" | ||
23 | v-dragscroll | ||
24 | class="ld-breadcrumb flex scrollbar" | ||
25 | @click.capture="e => dragScrollClickFix.onClickCapture(e)" | ||
26 | @dragscrollstart="dragScrollClickFix.onDragScrollStart()" | ||
27 | @dragscrollend="dragScrollClickFix.onDragScrollEnd()" | ||
28 | @dragscrollmove="checkForOverflowMask" | ||
29 | > | ||
30 | <div v-show="overflowMask" class="ld-breadcrumb-overflow-mask"></div> | ||
31 | <ul class="ld-breadcrumb"> | ||
32 | <li v-for="(item, idx) in currentItemPath" :key="item.path"> | ||
33 | <fa-icon v-if="idx > 0" icon="angle-right" class="disabled" /> | ||
34 | <router-link :to="item.path" class="link"> | ||
35 | <fa-icon :icon="getIcon(item)" size="lg" /> | ||
36 | {{ item.title }} | ||
37 | </router-link> | ||
38 | </li> | ||
39 | <li v-if="searchMode"> | ||
40 | <fa-icon icon="angle-right" class="disabled" /> | ||
41 | <router-link :to="$route" class="link"> | ||
42 | <fa-icon icon="search" size="lg" class="disabled" /> | ||
43 | </router-link> | ||
44 | </li> | ||
45 | </ul> | ||
46 | </div> | ||
47 | </template> | ||
48 | |||
49 | <script lang="ts"> | ||
50 | import { Component, Vue, Ref, Watch, Prop } from "vue-property-decorator"; | ||
51 | import DragScrollClickFix from "@/services/dragscrollclickfix"; | ||
52 | import Navigation from "@/services/navigation"; | ||
53 | |||
54 | @Component | ||
55 | export default class LdBreadcrumb extends Vue { | ||
56 | @Prop({ type: Array, required: true }) readonly currentItemPath!: Gallery.Item[]; | ||
57 | @Prop(Boolean) readonly searchMode!: boolean; | ||
58 | @Ref() readonly breadcrumb!: HTMLUListElement; | ||
59 | |||
60 | readonly dragScrollClickFix = new DragScrollClickFix(); | ||
61 | |||
62 | dragging: boolean = false; | ||
63 | overflowMask: boolean = false; | ||
64 | |||
65 | mounted() { | ||
66 | window.addEventListener("resize", this.checkForOverflowMask); | ||
67 | } | ||
68 | |||
69 | destroyed() { | ||
70 | window.removeEventListener("resize", this.checkForOverflowMask); | ||
71 | } | ||
72 | |||
73 | checkForOverflowMask() { | ||
74 | this.overflowMask = this.breadcrumb.scrollLeft > 1; | ||
75 | } | ||
76 | |||
77 | @Watch("currentItemPath") | ||
78 | changedCurrentItemPath() { | ||
79 | this.$nextTick(() => { | ||
80 | this.breadcrumb.scrollLeft = this.breadcrumb.scrollWidth; | ||
81 | this.checkForOverflowMask(); | ||
82 | }); | ||
83 | } | ||
84 | |||
85 | getIcon(item: Gallery.Item) { | ||
86 | return Navigation.getIcon(item); | ||
87 | } | ||
88 | } | ||
89 | </script> | ||
90 | |||
91 | <style lang="scss"> | ||
92 | @import "~@/assets/scss/theme.scss"; | ||
93 | |||
94 | .ld-breadcrumb-overflow-mask { | ||
95 | position: absolute; | ||
96 | width: 100%; | ||
97 | height: 100%; | ||
98 | background: linear-gradient( | ||
99 | to right, | ||
100 | rgba($panel-top-bgcolor, 1) $breadcrumb-margins, | ||
101 | rgba($panel-top-bgcolor, 0) $breadcrumb-overflow-mask-size | ||
102 | ); | ||
103 | pointer-events: none; | ||
104 | } | ||
105 | |||
106 | .ld-breadcrumb { | ||
107 | ul { | ||
108 | display: flex; | ||
109 | white-space: nowrap; | ||
110 | } | ||
111 | a { | ||
112 | padding: $breadcrumb-margins 0; | ||
113 | margin-left: $breadcrumb-margins; | ||
114 | } | ||
115 | li { | ||
116 | align-self: center; | ||
117 | margin-right: $breadcrumb-margins; | ||
118 | } | ||
119 | &.scrollbar { | ||
120 | overflow-y: hidden; | ||
121 | scrollbar-width: none; | ||
122 | &::-webkit-scrollbar { | ||
123 | height: 0; | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | </style> | ||