Updated Gallery component

This commit is contained in:
Sebin Nyshkim 2019-11-05 22:05:53 +01:00
parent 430d087a2d
commit 216e78fc5f

View file

@ -1,9 +1,12 @@
<template> <template>
<div class="gallery"> <div class="gallery">
<div class="big-image"> <div class="big-image">
<div class="image-container"> <figure class="image-container">
<img :src="bigImage" alt="" /> <img :src="bigImage" alt="" />
</div> <figcaption>
{{ images.indexOf(bigImage) + 1 }} / {{ images.length }}
</figcaption>
</figure>
</div> </div>
<div class="thumbnails"> <div class="thumbnails">
<div class="thumbnail" v-for="(img, index) in images" :key="index"> <div class="thumbnail" v-for="(img, index) in images" :key="index">
@ -45,7 +48,11 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.big-image { .big-image {
width: 100%; width: 100%;
height: 480px; height: 40vh;
@media (min-width: 35em) {
height: 30em;
}
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -53,25 +60,44 @@ export default {
align-items: center; align-items: center;
background-color: #444; background-color: #444;
overflow: hidden;
} }
.image-container { .image-container {
flex: 1; position: relative;
margin: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
flex: 1;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-content: center; align-content: center;
align-items: center; align-items: center;
box-shadow: inset 0 0 15em #000;
img { img {
align-self: center; align-self: center;
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
} }
figcaption {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: rgba(#000, 0.5);
color: #fff;
text-align: center;
}
} }
.thumbnails { .thumbnails {
@ -79,7 +105,9 @@ export default {
align-content: center; align-content: center;
align-items: center; align-items: center;
height: 5em; height: 6.5em;
padding: 0.5em;
overflow-x: scroll; overflow-x: scroll;
@ -99,7 +127,17 @@ export default {
align-content: center; align-content: center;
align-items: center; align-items: center;
& + .thumbnail {
margin-left: 0.5em;
}
img { img {
cursor: pointer;
box-sizing: border-box;
border: 0.25em solid #fff;
align-self: center; align-self: center;
max-width: 100%; max-width: 100%;