Fix Icon Lazy Loading (#2984)

Fix Icon picker
This commit is contained in:
Charles Bochet
2023-12-14 12:13:02 +01:00
committed by GitHub
parent ed2cd408bf
commit 8916dee352
33 changed files with 4366 additions and 192 deletions

View File

@ -0,0 +1,20 @@
import { useRecoilValue } from 'recoil';
import { Icon123 } from '@/ui/display/icon';
import { iconsState } from '@/ui/display/icon/states/iconsState';
export const useIcons = () => {
const icons = useRecoilValue(iconsState);
const defaultIcon = Icon123;
const getIcons = () => {
return icons;
};
const getIcon = (iconKey?: string | null) => {
if (!iconKey) return defaultIcon;
return icons[iconKey] ?? defaultIcon;
};
return { getIcons, getIcon };
};