feat: image lazy loading
This commit is contained in:
parent
0c3fe43be7
commit
52b88ee559
@ -22,10 +22,14 @@ export const getPresenter = (content:Document):PagePresenter => {
|
|||||||
return ()=><Typography variant='h2'>Not implemented reader</Typography>;
|
return ()=><Typography variant='h2'>Not implemented reader</Typography>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ThumbnailContainer = (props:{content:Document, className?:string, style?:React.CSSProperties})=>{
|
export function ThumbnailContainer(props:{
|
||||||
|
content:Document,
|
||||||
|
className?:string,
|
||||||
|
style?:React.CSSProperties,
|
||||||
|
}){
|
||||||
const thumbnailurl = makeThumbnailUrl(props.content);
|
const thumbnailurl = makeThumbnailUrl(props.content);
|
||||||
if(props.content.content_type === "video"){
|
if(props.content.content_type === "video"){
|
||||||
return (<video src={thumbnailurl} muted autoPlay loop className={props.className} style={props.style}></video>)
|
return (<video src={thumbnailurl} muted autoPlay loop className={props.className} style={props.style}></video>)
|
||||||
}
|
}
|
||||||
else return (<img src={thumbnailurl} className={props.className} style={props.style}></img>)
|
else return (<img src={thumbnailurl} className={props.className} style={props.style} loading="lazy"></img>)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user