schlechtenburg/packages/image/lib/display.tsx

36 lines
643 B
TypeScript
Raw Normal View History

2020-12-30 01:32:46 +00:00
import { defineComponent, PropType } from 'vue';
2020-05-27 15:06:14 +00:00
import {
model,
2020-12-30 13:34:23 +00:00
SbBlock,
} from '@schlechtenburg/core';
2020-05-27 15:06:14 +00:00
import {
getDefaultData,
ImageData,
} from './util';
import './style.scss';
2020-12-30 01:32:46 +00:00
export default defineComponent({
2020-05-27 15:06:14 +00:00
name: 'sb-image-display',
model,
props: {
data: {
type: (null as unknown) as PropType<ImageData>,
default: getDefaultData,
},
},
2021-03-08 15:29:35 +00:00
setup(props) {
2020-12-30 01:32:46 +00:00
return () => <figure class="sb-image">
<img
class="sb-image__content"
src={props.data.src}
alt={props.data.alt}
/>
<SbBlock block={props.data.description} />
</figure>;
2020-05-27 15:06:14 +00:00
},
});