Rename Image component to ServerHeroImage (#24894)
This commit is contained in:
parent
51b83ed195
commit
ab7716cff4
3 changed files with 5 additions and 5 deletions
|
@ -1,33 +0,0 @@
|
|||
import React, { useCallback, useState } from 'react';
|
||||
import { Blurhash } from './blurhash';
|
||||
import classNames from 'classnames';
|
||||
|
||||
type Props = {
|
||||
src: string;
|
||||
srcSet?: string;
|
||||
blurhash?: string;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export const Image: React.FC<Props> = ({
|
||||
src,
|
||||
srcSet,
|
||||
blurhash,
|
||||
className,
|
||||
}) => {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
const handleLoad = useCallback(() => {
|
||||
setLoaded(true);
|
||||
}, [setLoaded]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classNames('image', { loaded }, className)}
|
||||
role='presentation'
|
||||
>
|
||||
{blurhash && <Blurhash hash={blurhash} className='image__preview' />}
|
||||
<img src={src} srcSet={srcSet} alt='' onLoad={handleLoad} />
|
||||
</div>
|
||||
);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue