schlechtenburg/packages/image/lib/display.tsx

40 lines
703 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,
blockProps,
2020-12-30 13:34:23 +00:00
SbBlock,
} from '@schlechtenburg/core';
2020-05-27 15:06:14 +00:00
import {
getDefaultData,
ImageData,
ImageProps,
} 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: {
...blockProps,
data: {
type: (null as unknown) as PropType<ImageData>,
default: getDefaultData,
},
},
2020-05-27 15:32:35 +00:00
setup(props: ImageProps) {
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
},
});