Fix favorite button (#9001)

Closes #8977
This commit is contained in:
Raphaël Bosi 2024-12-10 15:20:37 +01:00 committed by GitHub
parent afd3252cbe
commit 90d47a8fca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { Button, IconButton, IconHeart } from 'twenty-ui';
import { Button, IconButton, IconHeart, IconHeartOff } from 'twenty-ui';
type PageFavoriteButtonProps = {
isFavorite: boolean;
@ -11,18 +11,20 @@ export const PageFavoriteButton = ({
onClick,
}: PageFavoriteButtonProps) => {
const title = isFavorite ? 'Remove from favorites' : 'Add to favorites';
const isPageHeaderV2Enabled = useIsFeatureEnabled(
'IS_PAGE_HEADER_V2_ENABLED',
);
return (
<>
{isPageHeaderV2Enabled ? (
<Button
Icon={IconHeart}
Icon={isFavorite ? IconHeartOff : IconHeart}
dataTestId="favorite-button"
size="small"
variant="secondary"
accent={isFavorite ? 'danger' : 'default'}
accent="default"
title={title}
onClick={onClick}
ariaLabel={title}