feat: image lazy loading
This commit is contained in:
		
							parent
							
								
									0c3fe43be7
								
							
						
					
					
						commit
						52b88ee559
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -22,10 +22,14 @@ export const getPresenter = (content:Document):PagePresenter => {
 | 
			
		|||
    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);
 | 
			
		||||
    if(props.content.content_type === "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…
	
	Add table
		
		Reference in a new issue