| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <template lang="pug">
- .gallery.active.f-col.center
- button(@click="hideGallery").hide hide gallery ▲
- figure.f-col.center
- p {{images}}
- img(:src="Object.values(images)[selected]")
- p active: {{ selected }}
- .titledesc.t-left {{titledesc}}
- h2 Title goes here: Responsive block to fit different screen sizes. Hide/Show from bottom of the screen.
- p Description goes here: London. Michaelmas term lately over, and the Lord Chancellor sitting in Lincoln's Inn Hall. Implacable November weather. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Blue McRight is an inter-disciplinary artist influenced by nature, personal experience, and politics. At its core, her multi-media work focuses on water – and its lack – as an environmental issue; however her practice has expanded to address related ideas such as the body, circulatory systems, and marine science. McRight’s work is both elusive and interactive, inviting viewer engagement and contemplation.
-
- .controls.f-row
- button(v-if="selected > 0" @click="prev") ◀prev
- .f-grow
- button(v-if="selected < Object.values(images).length - 1" @click="next") next ▶
- </template>
-
- <script>
- export default {
- props: {
- activeImageIndex: { type: Number, required: true, default: 0 },
- images: { type: Object, required: true },
- },
- data() {
- return {
- selected: 0,
- }
- },
- methods: {
- prev() {
- this.selected > 0
- ? this.selected--
- : (this.selected = Object.keys(this.images).length - 1)
- },
- next() {
- this.selected < Object.keys(this.images).length - 1
- ? this.selected++
- : (this.selected = 0)
- },
- hideGallery() {
- this.$emit('close')
- },
- interpretKeypress(e) {
- switch (e.key) {
- case 'ArrowRight':
- this.next()
- break
- case 'ArrowLeft':
- this.prev()
- break
- case 'Escape':
- this.hideGallery()
- break
- }
- },
- },
- watch: {
- activeImageIndex(newVal, oldVal) {
- this.selected = newVal
- },
- },
- async mounted() {
- // Set the first selection
- this.selected = this.activeImageIndex
- window.addEventListener('keydown', this.interpretKeypress)
- },
- unmounted() {
- window.removeEventListener('keydown', this.interpretKeypress)
- },
- }
- </script>
-
- <style lang="postcss">
- // prettier-ignore
- @import '../sss/variables.sss'
- @import '../sss/theme.sss'
-
- .gallery
- overflow: hidden
- .wrap
- /* width: 60vw */
- &.active
- position: fixed
- top: 0
- left: 0
- width: 100%
- height: 100%
- background-color: rgba(255, 0, 0, 0.6)
- z-index: 1001
-
- > * /* select for all direct children */
- opacity: 100%
- position: relative
- max-height: 95vh
- z-index: 1011
- button.hide
- position: fixed
- top: 0
- padding: 4px
- color: $cia_red
- z-index: 1100
- figure
- img
- background-size: auto
- max-width: 90vw
- max-height: 80vh
- .titledesc
- position: fixed
- max-width: 90vw
- bottom: 1vh
- background-color: rgba(255, 255, 255, 0.6)
- padding: 1.0em
- text-align: left
- h2, p
- color: $cia_black
- .controls
- position: absolute
- width: 100vw
- button
- background-color: rgba(255, 255, 255, 0.1)
- height: 100vh
- padding: 1.0em
- </style>
|