## After <img width="1220" alt="image" src="https://github.com/user-attachments/assets/98a73aae-80d7-4e92-93d3-be13210da88b" /> <img width="1131" alt="image" src="https://github.com/user-attachments/assets/9919e415-4355-4995-8979-9055b821f1e9" /> <img width="1300" alt="image" src="https://github.com/user-attachments/assets/27f11cb3-d72c-468a-a641-8414172b9b54" /> <img width="1353" alt="image" src="https://github.com/user-attachments/assets/2f0037f2-fe17-48b6-b7e6-c7528687a5fd" />
22 lines
548 B
TypeScript
22 lines
548 B
TypeScript
import { useRecoilValue } from 'recoil';
|
|
|
|
import { Icon123 } from '@ui/display/icon/components/TablerIcons';
|
|
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, customDefaultIcon?: string) => {
|
|
return (
|
|
icons[iconKey ?? ''] || icons[customDefaultIcon ?? ''] || defaultIcon
|
|
);
|
|
};
|
|
|
|
return { getIcons, getIcon };
|
|
};
|