mirror of https://github.com/msgbyte/tailchat
perf: update icon with placeholder
parent
3a19fed9c4
commit
0a833812d8
@ -0,0 +1,14 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { Icon as Iconify, IconProps } from '@iconify/react';
|
||||||
|
|
||||||
|
export const Icon: React.FC<Omit<IconProps, 'ref'>> = React.memo((props) => {
|
||||||
|
const [loaded, setLoaded] = useState(false);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Iconify {...props} onLoad={() => setLoaded(true)} />
|
||||||
|
{!loaded && <span style={{ width: '1em', height: '1em' }} />}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
Icon.displayName = 'Icon';
|
Loading…
Reference in New Issue