schlechtenburg/packages/image/lib/view.tsx

36 lines
645 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,
2022-03-11 17:23:14 +00:00
IImageData,
2020-05-27 15:06:14 +00:00
} 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: {
2022-03-11 17:23:14 +00:00
type: (null as unknown) as PropType<IImageData>,
2020-05-27 15:06:14 +00:00
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
},
});