Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix(default-theme): display text next to image in block (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malwurf authored Aug 28, 2020
1 parent c7b8e0b commit 30e422c
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions packages/default-theme/cms/blocks/CmsBlockTextOnImage.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<template>
<article class="cms-block-text-on-image">
<CmsGenericElement
v-if="getContent"
:content="getContent"
class="cms-block-text-on-image__content"
:content="getLeftContent"
class="cms-block-text-on-image__image"
/>
<CmsGenericElement
:content="getRightContent"
class="cms-block-text-on-image__text"
/>
</article>
</template>
Expand All @@ -29,20 +32,53 @@ export default {
getSlots() {
return this.content.slots || []
},
getContent() {
return this.getSlots.length && this.getSlots[0]
getLeftContent() {
return this.getSlots.find(({ slot }) => slot === "left")
},
getRightContent() {
return this.getSlots.find(({ slot }) => slot === "right")
},
},
}
</script>

<style lang="scss" scoped>
@import "@/assets/scss/variables";
.cms-block-text-on-image {
background-position: center;
background-size: cover;
display: flex;
flex-direction: column;
margin-right: 0;
margin-left: 0;
&__image,
&__text {
margin: var(--spacer-sm);
flex: 1;
& img {
height: 340px;
object-fit: cover;
width: 100%;
}
}
@include for-desktop {
align-items: center;
flex-direction: row;
justify-content: space-around;
.cms-block-text-on-image__image {
margin-bottom: 0;
margin-right: var(--spacer-sm);
margin-top: 0;
}
&__content {
padding: var(--spacer-2xl) var(--spacer-xl);
.cms-block-text-on-image__text {
margin-bottom: 0;
margin-left: var(--spacer-sm);
margin-top: 0;
}
}
}
</style>

1 comment on commit 30e422c

@vercel
Copy link

@vercel vercel bot commented on 30e422c Aug 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.