Split from https://github.com/twentyhq/twenty/pull/4518 Part of https://github.com/twentyhq/twenty/issues/4766
21 lines
504 B
TypeScript
21 lines
504 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) => {
|
|
if (!iconKey) return defaultIcon;
|
|
return icons[iconKey] ?? defaultIcon;
|
|
};
|
|
|
|
return { getIcons, getIcon };
|
|
};
|