From 62fff5ca60da1f887c1f95fa4808d3753596dab2 Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Mon, 22 Feb 2021 16:01:13 +0000 Subject: [PATCH] feat: larger previewer content --- frontend/src/components/files/Preview.vue | 43 ++++++++++++++++------- frontend/src/css/styles.css | 27 +++++++++++--- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/files/Preview.vue b/frontend/src/components/files/Preview.vue index 8b42a0da..523efd72 100644 --- a/frontend/src/components/files/Preview.vue +++ b/frontend/src/components/files/Preview.vue @@ -1,5 +1,5 @@ @@ -66,6 +66,7 @@ import { mapState } from 'vuex' import url from '@/utils/url' import { baseURL, resizePreview } from '@/utils/constants' import { files as api } from '@/api' +import throttle from 'lodash.throttle' import PreviewSizeButton from '@/components/buttons/PreviewSize' import InfoButton from '@/components/buttons/Info' import DeleteButton from '@/components/buttons/Delete' @@ -97,7 +98,10 @@ export default { listing: null, name: '', subtitles: [], - fullSize: false + fullSize: false, + showNav: true, + navTimeout: null, + hoverNav: false } }, computed: { @@ -130,6 +134,7 @@ export default { watch: { $route: function () { this.updatePreview() + this.toggleNavigation() } }, async mounted () { @@ -162,9 +167,11 @@ export default { this.$router.push({ path: uri }) }, prev () { + this.hoverNav = false this.$router.push({ path: this.previousLink }) }, next () { + this.hoverNav = false this.$router.push({ path: this.nextLink }) }, key (event) { @@ -232,7 +239,19 @@ export default { }, toggleSize () { this.fullSize = !this.fullSize - } + }, + toggleNavigation: throttle(function() { + this.showNav = true + + if (this.navTimeout) { + clearTimeout(this.navTimeout) + } + + this.navTimeout = setTimeout(() => { + this.showNav = false || this.hoverNav + this.navTimeout = null + }, 1500); + }, 500) } } diff --git a/frontend/src/css/styles.css b/frontend/src/css/styles.css index aed59c60..b8afd786 100644 --- a/frontend/src/css/styles.css +++ b/frontend/src/css/styles.css @@ -152,10 +152,8 @@ } #previewer .preview { - margin: 2em auto 4em; - max-width: 80%; text-align: center; - height: calc(100vh - 9.7em); + height: calc(100vh - 3.7em); } #previewer .preview pre { @@ -170,6 +168,10 @@ margin: 0; } +#previewer .preview video { + height: 100%; +} + #previewer .pdf { width: 100%; height: 100%; @@ -182,8 +184,25 @@ #previewer>button { margin: 0; position: fixed; - top: 50%; + top: calc(50% + 1.85em); transform: translateY(-50%); + background-color: rgba(80, 80, 80, .5); + color: white; + border-radius: 50%; + cursor: pointer; + border: 0; + margin: 0; + padding: 0; + transition: 0.2s ease all; +} + +#previewer>button.hidden { + opacity: 0; + visibility: hidden; +} + +#previewer>button>i { + padding: 0.4em; } #previewer>button:first-of-type {