8928 refactor page header buttons (#8952)

Closes #8928 

<img width="1296" alt="Capture d’écran 2024-12-09 à 10 26 37"
src="https://github.com/user-attachments/assets/f33202b0-9c11-48da-8daa-e867d62a1803">
<img width="1296" alt="Capture d’écran 2024-12-09 à 10 26 54"
src="https://github.com/user-attachments/assets/a94f89d4-ca12-403f-bfcb-12168a82f77c">
This commit is contained in:
Raphaël Bosi
2024-12-09 10:55:33 +01:00
committed by GitHub
parent ef0ae2568d
commit 387f5259a7
10 changed files with 70 additions and 68 deletions

View File

@ -1,4 +1,4 @@
import { IconButton, IconHeart } from 'twenty-ui';
import { Button, IconHeart } from 'twenty-ui';
type PageFavoriteButtonProps = {
isFavorite: boolean;
@ -8,13 +8,18 @@ type PageFavoriteButtonProps = {
export const PageFavoriteButton = ({
isFavorite,
onClick,
}: PageFavoriteButtonProps) => (
<IconButton
Icon={IconHeart}
size="medium"
variant="secondary"
data-testid="add-button"
accent={isFavorite ? 'danger' : 'default'}
onClick={onClick}
/>
);
}: PageFavoriteButtonProps) => {
const title = isFavorite ? 'Remove from favorites' : 'Add to favorites';
return (
<Button
Icon={IconHeart}
dataTestId="favorite-button"
size="small"
variant="secondary"
accent={isFavorite ? 'danger' : 'default'}
title={title}
onClick={onClick}
ariaLabel={title}
/>
);
};