diff options
Diffstat (limited to 'viewer/src/components/LdCommand.vue')
-rw-r--r-- | viewer/src/components/LdCommand.vue | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue new file mode 100644 index 0000000..07cb354 --- /dev/null +++ b/viewer/src/components/LdCommand.vue | |||
@@ -0,0 +1,74 @@ | |||
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 class="flex command-btns"> | ||
22 | <div class="link" title="$t('title.tags')" @click="$uiStore.toggleFullWidth()"> | ||
23 | <fa-icon :icon="commandTagsIcon()" size="lg" /> | ||
24 | </div> | ||
25 | <router-link to="/" :class="{'disabled': isRoot()}" title="$t('title.home')"> | ||
26 | <fa-icon icon="home" size="lg" /> | ||
27 | </router-link> | ||
28 | <div class="link" title="$t('title.back')" @click="$router.go(-1)"> | ||
29 | <fa-icon icon="arrow-left" size="lg" /> | ||
30 | </div> | ||
31 | <router-link :class="{'disabled': isRoot()}" title="$t('title.parent')" :to="parent()"> | ||
32 | <fa-icon icon="folder" size="xs" /> | ||
33 | <fa-icon icon="level-up-alt" size="lg" /> | ||
34 | </router-link> | ||
35 | </div> | ||
36 | </template> | ||
37 | |||
38 | <script lang="ts"> | ||
39 | import { Component, Vue } from "vue-property-decorator"; | ||
40 | import { RawLocation } from "vue-router"; | ||
41 | |||
42 | @Component | ||
43 | export default class LdCommand extends Vue { | ||
44 | commandTagsIcon(): string { | ||
45 | return this.$uiStore.fullWidth ? "tags" : "window-close"; | ||
46 | } | ||
47 | |||
48 | isRoot(): boolean { | ||
49 | return this.$galleryStore.currentItemPath.length <= 1; | ||
50 | } | ||
51 | |||
52 | parent(): RawLocation { | ||
53 | if (!this.isRoot()) return this.$galleryStore.currentItemPath[this.$galleryStore.currentItemPath.length - 2]; | ||
54 | return ""; | ||
55 | } | ||
56 | } | ||
57 | </script> | ||
58 | |||
59 | <style lang="scss"> | ||
60 | @import "@/assets/scss/theme.scss"; | ||
61 | |||
62 | .command-btns { | ||
63 | justify-content: space-around; | ||
64 | vertical-align: middle; | ||
65 | align-items: center; | ||
66 | width: $layout-left; | ||
67 | > * { | ||
68 | // Unify the minor size differences between icons | ||
69 | width: 26px; | ||
70 | height: 26px; | ||
71 | margin-top: 2px; | ||
72 | } | ||
73 | } | ||
74 | </style> | ||