mirror of
https://github.com/lingble/twenty.git
synced 2025-11-17 06:25:06 +00:00
Introduced Specific Icons image identifier for Notes and Tasks (#6997)
Fixes #6486
This commit is contained in:
@@ -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 };
|
||||
};
|
||||
Reference in New Issue
Block a user