Files
mixtape/zero.Backoffice.UI/old_app/components/modules/predefined/module-preview-text.vue
T

70 lines
1.3 KiB
Vue
Raw Normal View History

2020-08-20 14:35:08 +02:00
<template>
<div class="ui-module-preview-text">
2021-09-23 12:15:20 +02:00
<p class="-text" v-if="text" v-html="textContent" :style="{ '-webkit-line-clamp': maxLines }"></p>
2021-01-26 15:33:54 +01:00
<p class="-subline" v-if="subline" v-html="sublineContent"></p>
2020-08-20 14:35:08 +02:00
</div>
</template>
<script>
import Strings from 'zero/helpers/strings.js';
2020-08-20 14:35:08 +02:00
export default {
name: 'uiModulePreviewText',
props: {
text: {
type: String
},
subline: {
type: String
},
2021-09-23 12:15:20 +02:00
maxLines: {
type: Number,
default: 6
},
html: {
type: Boolean,
default: false
}
},
computed: {
textContent()
{
2021-09-23 12:15:20 +02:00
return this.html ? this.text : Strings.htmlToText(this.text, true);
},
sublineContent()
{
return this.html ? this.subline : Strings.htmlToText(this.subline);
2020-08-20 14:35:08 +02:00
}
}
}
</script>
<style lang="scss">
.ui-module-preview-text
{
font-size: var(--font-size);
line-height: 1.5;
2021-09-23 12:15:20 +02:00
.-text, .-subline
2020-08-20 14:35:08 +02:00
{
2021-09-23 12:15:20 +02:00
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
display: -webkit-box;
2020-08-20 14:35:08 +02:00
}
2021-10-11 13:58:14 +02:00
/*.-text > br:first-child
{
display: none;
}*/
2021-01-26 15:33:54 +01:00
p.-subline
2020-08-20 14:35:08 +02:00
{
color: var(--color-text-dim);
2020-08-20 14:35:08 +02:00
font-size: var(--font-size-s);
2021-01-26 15:33:54 +01:00
margin-top: 0.2em;
2020-08-20 14:35:08 +02:00
}
}
</style>