mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-24 09:36:42 +01:00
27 lines
419 B
React
27 lines
419 B
React
|
import './avatar.css';
|
||
|
|
||
|
const SIZES = {
|
||
|
s: 16,
|
||
|
m: 20,
|
||
|
l: 24,
|
||
|
xl: 32,
|
||
|
xxl: 50,
|
||
|
};
|
||
|
|
||
|
export default ({ url, size, alt = '' }) => {
|
||
|
size = SIZES[size] || size || SIZES.m;
|
||
|
return (
|
||
|
<span
|
||
|
class="avatar"
|
||
|
style={{
|
||
|
width: size,
|
||
|
height: size,
|
||
|
}}
|
||
|
>
|
||
|
{!!url && (
|
||
|
<img src={url} width={size} height={size} alt={alt} loading="lazy" />
|
||
|
)}
|
||
|
</span>
|
||
|
);
|
||
|
};
|