mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
462 B
TypeScript
16 lines
462 B
TypeScript
import React, { useState } from 'react';
|
|
import { Icon as Iconify, IconProps } from '@iconify/react';
|
|
|
|
const placeHolderStyle = { width: '1em', height: '1em' };
|
|
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={placeHolderStyle} />}
|
|
</>
|
|
);
|
|
});
|
|
Icon.displayName = 'Icon';
|