Introduced Specific Icons image identifier for Notes and Tasks (#6997)

Fixes #6486
This commit is contained in:
nitin
2024-09-24 15:17:20 +05:30
committed by GitHub
parent e3547582d0
commit fcaa9d9aed
7 changed files with 86 additions and 11 deletions

View File

@@ -0,0 +1,37 @@
import { useTheme } from '@emotion/react';
import { IconCheckbox, IconComponent, IconNotes } from 'twenty-ui';
export const useGetStandardObjectIcon = (objectNameSingular: string) => {
const theme = useTheme();
const getIconForObjectType = (
objectType: string,
): IconComponent | undefined => {
switch (objectType) {
case 'note':
return IconNotes;
case 'task':
return IconCheckbox;
default:
return undefined;
}
};
const getIconColorForObjectType = (objectType: string): string => {
switch (objectType) {
case 'note':
return theme.color.yellow;
case 'task':
return theme.color.blue;
default:
return 'currentColor';
}
};
const { Icon, IconColor } = {
Icon: getIconForObjectType(objectNameSingular),
IconColor: getIconColorForObjectType(objectNameSingular),
};
return { Icon, IconColor };
};