publish: use backgroundImage for images

Fixes urbit/landscape#495
This commit is contained in:
Matilde Park 2021-03-02 16:36:34 -05:00
parent 5a474cf85b
commit 896313b4fd

View File

@ -68,7 +68,15 @@ export function NotePreview(props: NotePreviewProps) {
unwrapDisallowed
allowedTypes={['text', 'root', 'break', 'paragraph', 'image']}
renderers={{
image: props => <Image src={props.src} maxHeight='300px' style={{ objectFit: 'cover' }} />
image: props => (
<Box
backgroundImage={`url(${props.src})`}
style={{ backgroundSize: 'cover',
backgroundPosition: "center" }}
>
<Image src={props.src} opacity="0" maxHeight="300px"/>
</Box>
)
}}
source={snippet}
/>