aboutsummaryrefslogtreecommitdiff
path: root/src/site/components/grid/waterfall/WaterfallItem.vue
diff options
context:
space:
mode:
authorZephyrrus <[email protected]>2020-07-05 04:18:08 +0300
committerZephyrrus <[email protected]>2020-07-05 04:18:08 +0300
commit766e74cc51138b32482f65f0f2647eb9d943103e (patch)
treed675cdaa4dc4a89356009131707b11b511069494 /src/site/components/grid/waterfall/WaterfallItem.vue
parentfeat: refactor single album page to use vuex (diff)
downloadhost.fuwn.me-766e74cc51138b32482f65f0f2647eb9d943103e.tar.xz
host.fuwn.me-766e74cc51138b32482f65f0f2647eb9d943103e.zip
feat: add video preview on hover to dashboard and apply new linter rules to some of the files
Diffstat (limited to 'src/site/components/grid/waterfall/WaterfallItem.vue')
-rw-r--r--src/site/components/grid/waterfall/WaterfallItem.vue29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/site/components/grid/waterfall/WaterfallItem.vue b/src/site/components/grid/waterfall/WaterfallItem.vue
index 7c4d814..2a5c69a 100644
--- a/src/site/components/grid/waterfall/WaterfallItem.vue
+++ b/src/site/components/grid/waterfall/WaterfallItem.vue
@@ -12,26 +12,27 @@
<script>
import imagesLoaded from 'imagesloaded';
+
export default {
name: 'WaterfallItem',
props: {
order: {
type: Number,
- default: 0
+ default: 0,
},
width: {
type: Number,
- default: 150
+ default: 150,
},
video: {
type: Boolean,
- default: false
- }
+ default: false,
+ },
},
data() {
return {
itemWidth: 0,
- height: 0
+ height: 0,
};
},
created() {
@@ -42,18 +43,18 @@ export default {
this.$el.style.width = `${this.width}px`;
this.emit();
if (this.video) {
- const videoEl = this.$slots.default.find(e => e.tag?.toLowerCase() === 'video');
+ // find first video object
+ const videoEl = this.$slots.default.find((e) => e.tag?.toLowerCase() === 'video');
const el = videoEl.elm;
- console.log(videoEl);
- console.log(el);
+
+ // add event listener for video loaded
el.onloadeddata = () => {
- console.log('loaded');
this.$el.style.left = '-9999px';
this.$el.style.top = '-9999px';
this.$el.style.display = 'block';
this.height = el.offsetHeight + 5;
this.itemWidth = el.offsetWidth;
- }
+ };
} else {
imagesLoaded(this.$el, () => {
this.$el.style.left = '-9999px';
@@ -73,9 +74,9 @@ export default {
el: this.$el,
height: this.height,
width: this.itemWidth,
- order: this.order
+ order: this.order,
};
- }
- }
-}
+ },
+ },
+};
</script>