Skip to content

Commit

Permalink
feat: add enlarge on click functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Górski authored and mercs600 committed Oct 22, 2021
1 parent 7bda32c commit b0b75ff
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 6 additions & 2 deletions lib/templates/components/content/elements/CeImage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="ce-image">
<ce-header v-bind="$props" />
<media-gallery :gallery="gallery" />
<media-gallery :gallery="gallery" :enlarge-image-on-click="enlargeImageOnClick" />
</div>
</template>
<script>
Expand All @@ -17,7 +17,11 @@ export default {
gallery: {
type: Object,
required: true,
default: () => {}
default: () => ({})
},
enlargeImageOnClick: {
type: Boolean,
default: false
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion lib/templates/components/content/elements/CeTextpic.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="ce-textpic">
<media-gallery :gallery="gallery">
<media-gallery :gallery="gallery" :enlarge-image-on-click="enlargeImageOnClick">
<ce-header v-bind="$props" />
<html-parser :content="bodytext" />
</media-gallery>
Expand All @@ -23,6 +23,10 @@ export default {
bodytext: {
type: String,
required: true
},
enlargeImageOnClick: {
type: Boolean,
default: false
}
}
}
Expand Down
17 changes: 14 additions & 3 deletions lib/templates/components/content/elements/media/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
:key="rowKey"
class="ce-gallery__row"
>
<div
<component
:is="enlargeImageOnClick ? 'a' : 'div'"
v-for="(col, colKey) in row.columns"
:key="colKey"
class="ce-gallery__col"
v-bind="{
...(enlargeImageOnClick && {
target: '_blank',
href: col.publicUrl
})
}"
>
<ce-media-file :file="col" />
</div>
</component>
</div>
</div>
<div
Expand All @@ -38,7 +45,11 @@ export default {
gallery: {
type: Object,
required: true,
default: () => {}
default: () => ({})
},
enlargeImageOnClick: {
type: Boolean,
default: false
}
},
computed: {
Expand Down

0 comments on commit b0b75ff

Please sign in to comment.