bigbuffet-rw/app/soapbox/features/placeholder/components/placeholder_avatar.tsx

29 lines
527 B
TypeScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
import * as React from 'react';
2022-05-01 10:45:37 -07:00
interface IPlaceholderAvatar {
size: number,
}
/** Fake avatar to display while data is loading. */
const PlaceholderAvatar: React.FC<IPlaceholderAvatar> = ({ size }) => {
2022-03-21 11:09:01 -07:00
const style = React.useMemo(() => {
if (!size) {
return {};
}
2022-03-21 11:09:01 -07:00
return {
width: `${size}px`,
height: `${size}px`,
};
2022-03-21 11:09:01 -07:00
}, [size]);
return (
<div
2022-03-23 17:18:37 -07:00
className='rounded-full bg-slate-200 dark:bg-slate-700'
2022-03-21 11:09:01 -07:00
style={style}
/>
);
};
2022-03-21 11:09:01 -07:00
export default PlaceholderAvatar;