Skip to content

Commit

Permalink
icons fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ehconitin committed Nov 2, 2024
1 parent cd365f5 commit ed32234
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ProcessedFavorite } from '@/favorites/utils/sortFavorites';
import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandardObjectIcon';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { Avatar, isDefined, useIcons } from 'twenty-ui';
import { Avatar, useIcons } from 'twenty-ui';

const StyledIconWrapper = styled.div`
display: flex;
Expand All @@ -11,6 +11,7 @@ const StyledIconWrapper = styled.div`
`;

const StyledAvatar = styled(Avatar)`
background: inherit;
:hover {
cursor: grab;
}
Expand All @@ -22,33 +23,18 @@ export const FavoriteIcon = ({ favorite }: { favorite: ProcessedFavorite }) => {
const { Icon: StandardIcon, IconColor } = useGetStandardObjectIcon(
favorite.objectNameSingular || '',
);

if (isDefined(favorite.objectNameSingular) && isDefined(StandardIcon)) {
return (
<StyledIconWrapper>
<StandardIcon color={IconColor} size={theme.icon.size.md} />
</StyledIconWrapper>
);
}

if (isDefined(favorite.Icon)) {
const IconComponent = getIcon(favorite.Icon);
return (
<StyledIconWrapper>
<IconComponent size={theme.icon.size.md} />
</StyledIconWrapper>
);
}
const IconToUse = StandardIcon || (favorite.Icon ? getIcon(favorite.Icon) : undefined);
const iconColorToUse = StandardIcon ? IconColor : theme.font.color.secondary

return (
<StyledIconWrapper>
<StyledAvatar
placeholderColorSeed={favorite.recordId}
avatarUrl={favorite.avatarUrl}
type={favorite.avatarType}
placeholder={favorite.labelIdentifier}
className="unorganised-fav-avatar"
/>
</StyledIconWrapper>
<StyledAvatar
size="md"
type={favorite.avatarType}
Icon={IconToUse}
iconColor={iconColorToUse}
avatarUrl={favorite.avatarUrl}
placeholder={favorite.labelIdentifier}
placeholderColorSeed={favorite.recordId}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const RecordShowPageBaseHeader = ({
return (
<>
<PageFavoriteFoldersDropdown
key={FAVORITE_FOLDERS_DROPDOWN_ID}
dropdownId={FAVORITE_FOLDERS_DROPDOWN_ID}
isFavorite={isFavorite}
record={record}
Expand Down

0 comments on commit ed32234

Please sign in to comment.