schlechtenburg/packages/paragraph/lib/display.tsx
2021-03-08 16:29:35 +01:00

42 lines
666 B
TypeScript

import {
defineComponent,
computed,
PropType,
} from 'vue';
import {
model,
} from '@schlechtenburg/core';
import {
getDefaultData,
ParagraphData,
} from './util';
import './style.scss';
export default defineComponent({
name: 'sb-paragraph-display',
model,
props: {
data: {
type: Object as PropType<ParagraphData>,
default: getDefaultData,
},
},
setup(props) {
const classes = computed(() => ({
'sb-paragraph': true,
[`sb-paragraph_align-${props.data.align}`]: true,
}));
return () => <p
class={classes.value}
{...{
innerHTML: props.data.value,
}}
></p>;
},
});