aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdCommand.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/LdCommand.vue')
-rw-r--r--viewer/src/components/LdCommand.vue96
1 files changed, 96 insertions, 0 deletions
diff --git a/viewer/src/components/LdCommand.vue b/viewer/src/components/LdCommand.vue
new file mode 100644
index 0000000..d961519
--- /dev/null
+++ b/viewer/src/components/LdCommand.vue
@@ -0,0 +1,96 @@
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-- 2020 Pacien TRAN-GIRARD
6--
7-- This program is free software: you can redistribute it and/or modify
8-- it under the terms of the GNU Affero General Public License as
9-- published by the Free Software Foundation, either version 3 of the
10-- License, or (at your option) any later version.
11--
12-- This program is distributed in the hope that it will be useful,
13-- but WITHOUT ANY WARRANTY; without even the implied warranty of
14-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-- GNU Affero General Public License for more details.
16--
17-- You should have received a copy of the GNU Affero General Public License
18-- along with this program. If not, see <https://www.gnu.org/licenses/>.
19-->
20
21<template>
22 <div class="flex command-btns">
23 <a class="link" :title="$t('command.search')" @click="$uiStore.toggleFullWidth()">
24 <fa-icon :icon="commandToggleSearchPanelIcon()" size="lg" />
25 </a>
26 <a
27 :class="{'disabled': isEntryPoint()}"
28 class="link command-secondary"
29 :title="$t('command.back')"
30 @click="isEntryPoint() || $router.back()"
31 >
32 <fa-icon icon="arrow-left" size="lg" />
33 </a>
34 <router-link :class="{'disabled': isRoot()}" :title="$t('command.parent')" :to="parent()">
35 <fa-icon icon="folder" size="xs" />
36 <fa-icon icon="level-up-alt" size="lg" />
37 </router-link>
38 </div>
39</template>
40
41<script lang="ts">
42import { Component, Vue, Prop } from "vue-property-decorator";
43import { RawLocation } from "vue-router";
44
45@Component
46export default class LdCommand extends Vue {
47 @Prop({ type: Array, required: true }) readonly currentItemPath!: Gallery.Item[];
48
49 commandToggleSearchPanelIcon(): string {
50 return this.$uiStore.fullWidth ? "search" : "angle-double-left";
51 }
52
53 isRoot(): boolean {
54 return this.currentItemPath.length <= 1 && !this.$uiStore.searchMode;
55 }
56
57 isEntryPoint(): boolean {
58 return history.state?.ldgallery === "ENTRYPOINT"; // Set by MainLayout.vue
59 }
60
61 parent(): RawLocation {
62 if (this.$uiStore.searchMode) return this.$route.path;
63 if (this.currentItemPath.length > 1) return this.currentItemPath[this.currentItemPath.length - 2];
64 return "";
65 }
66}
67</script>
68
69<style lang="scss">
70@import "~@/assets/scss/_buefy_variables.scss";
71@import "~@/assets/scss/theme.scss";
72
73.command-btns {
74 background-color: $command-buttons-bgcolor;
75 justify-content: space-around;
76 vertical-align: middle;
77 align-items: center;
78 flex: 0 0 $layout-left;
79
80 > a {
81 // normalise icon active boxes
82 width: $layout-top;
83 line-height: $layout-top;
84 text-align: center;
85 vertical-align: middle;
86 }
87
88 @media only screen and (max-width: $tablet) {
89 flex: 0 1;
90
91 > .command-secondary {
92 display: none;
93 }
94 }
95}
96</style>