Skip to content

Commit

Permalink
feat: preview mobile dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiresviana committed Aug 18, 2020
1 parent be8683f commit 7787344
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<header v-if="!isEditor">
<header v-if="!isEditor && !isPreview">
<div>
<button @click="openSidebar" :aria-label="$t('buttons.toggleSidebar')" :title="$t('buttons.toggleSidebar')" class="action">
<i class="material-icons">menu</i>
Expand Down Expand Up @@ -108,6 +108,7 @@ export default {
'selectedCount',
'isFiles',
'isEditor',
'isPreview',
'isListing',
'isLogged'
]),
Expand Down
25 changes: 21 additions & 4 deletions frontend/src/components/files/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@
<span>{{ this.name }}</span>
</div>

<rename-button :disabled="loading" v-if="user.perm.rename"></rename-button>
<delete-button :disabled="loading" v-if="user.perm.delete"></delete-button>
<download-button :disabled="loading" v-if="user.perm.download"></download-button>
<info-button :disabled="loading"></info-button>
<button @click="openMore" id="more" :aria-label="$t('buttons.more')" :title="$t('buttons.more')" class="action">
<i class="material-icons">more_vert</i>
</button>

<div id="dropdown" :class="{ active : showMore }">
<rename-button :disabled="loading" v-if="user.perm.rename"></rename-button>
<delete-button :disabled="loading" v-if="user.perm.delete"></delete-button>
<download-button :disabled="loading" v-if="user.perm.download"></download-button>
<info-button :disabled="loading"></info-button>
</div>
</div>

<div class="loading" v-if="loading">
Expand Down Expand Up @@ -51,6 +57,8 @@
</a>
</div>
</template>

<div v-show="showMore" @click="resetPrompts" class="overlay"></div>
</div>
</template>

Expand Down Expand Up @@ -109,6 +117,9 @@ export default {
},
raw () {
return `${this.previewUrl}&inline=true`
},
showMore () {
return this.$store.state.show === 'more'
}
},
watch: {
Expand Down Expand Up @@ -189,6 +200,12 @@ export default {
return
}
},
openMore () {
this.$store.commit('showHover', 'more')
},
resetPrompts () {
this.$store.commit('closeHovers')
}
}
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const getters = {
isFiles: state => !state.loading && state.route.name === 'Files',
isListing: (state, getters) => getters.isFiles && state.req.isDir,
isEditor: (state, getters) => getters.isFiles && (state.req.type === 'text' || state.req.type === 'textImmutable'),
isPreview: state => state.previewMode,
selectedCount: state => state.selected.length,
progress : state => {
if (state.upload.progress.length == 0) {
Expand Down

0 comments on commit 7787344

Please sign in to comment.