From 496be1635acbef640163807f4f2cfe2e9a2b4af7 Mon Sep 17 00:00:00 2001 From: Joel Rainwater Date: Tue, 12 Feb 2019 15:02:55 +0100 Subject: [PATCH 01/39] Add video data to store and display placeholder with play icon in gallery --- .../catalog/components/ProductGallery.ts | 3 ++ core/modules/catalog/helpers/index.ts | 13 ++++-- .../components/core/ProductGallery.vue | 41 ++++++++++++++++++- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/core/modules/catalog/components/ProductGallery.ts b/core/modules/catalog/components/ProductGallery.ts index a08de70f66..be60addbf7 100644 --- a/core/modules/catalog/components/ProductGallery.ts +++ b/core/modules/catalog/components/ProductGallery.ts @@ -88,6 +88,9 @@ export const ProductGallery = { if (this.isZoomOpen && event.keyCode === 27) { this.toggleZoom() } + }, + initVideo (video) { + console.log(video) } } } diff --git a/core/modules/catalog/helpers/index.ts b/core/modules/catalog/helpers/index.ts index 23ceac4308..103e45957c 100644 --- a/core/modules/catalog/helpers/index.ts +++ b/core/modules/catalog/helpers/index.ts @@ -533,10 +533,15 @@ export function getMediaGallery (product) { if (product.media_gallery) { for (let mediaItem of product.media_gallery) { if (mediaItem.image) { - mediaGallery.push({ - 'src': getThumbnailPath(mediaItem.image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height), - 'loading': getThumbnailPath(product.image, 310, 300) - }) + let computedImage = { + 'src': getThumbnailPath(mediaItem.image, rootStore.state.config.products.gallery.width, rootStore.state.config.products.gallery.height), + 'loading': getThumbnailPath(product.image, 310, 300), + 'video': null + } + if (mediaItem.vid) { + computedImage.video = mediaItem.vid + } + mediaGallery.push(computedImage) } } } diff --git a/src/themes/default/components/core/ProductGallery.vue b/src/themes/default/components/core/ProductGallery.vue index 1dd2f5af70..b937a8fb77 100644 --- a/src/themes/default/components/core/ProductGallery.vue +++ b/src/themes/default/components/core/ProductGallery.vue @@ -37,7 +37,7 @@ -
+
+
@@ -141,6 +148,38 @@ img[lazy=loading] { margin: 0 20px 20px 0; } } + +.video-container { + position: relative; + display: flex; + align-items: center; + justify-content: center; + + .gallery-video { + position: absolute; + width: 100%; + height: 100%; + top: 0; + + > .material-icons { + position: absolute; + left: 0; + right: 0; + color: #fff; + font-size: 120px; + top: calc( 50% - 60px); + transition: transform ease 0.3s; + } + + &:hover { + cursor: pointer; + + > .material-icons { + transform: scale(1.1); + } + } + } +} diff --git a/src/themes/default/components/core/ProductGallery.vue b/src/themes/default/components/core/ProductGallery.vue index 2e99432771..8637d79d9a 100644 --- a/src/themes/default/components/core/ProductGallery.vue +++ b/src/themes/default/components/core/ProductGallery.vue @@ -58,18 +58,21 @@ play_circle_outline
+