Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | 142x | import clsx from 'clsx';
import { memo, useCallback } from 'react';
import { useIntl } from 'react-intl';
import { UnstyledButton } from '@allshares/studio-design-system';
import { type BadgeConfigurationIcon } from '@amalia/payout-definition/plans/types';
import { PlanAwardIcon } from '../../award-icon/PlanAwardIcon';
import * as styles from './PlanAwardIconSelectOption.styles';
export type PlanAwardIconSelectOptionProps = {
readonly icon: BadgeConfigurationIcon;
readonly onClick: (icon: BadgeConfigurationIcon) => void;
readonly isSelected?: boolean;
};
export const PlanAwardIconSelectOption = memo(function PlanAwardIconSelectOption({
icon,
onClick,
isSelected,
}: PlanAwardIconSelectOptionProps) {
const { formatMessage } = useIntl();
const handleClick = useCallback(() => onClick(icon), [icon, onClick]);
return (
<UnstyledButton
aria-label={formatMessage({ defaultMessage: 'Pick icon {icon}' }, { icon })}
className={clsx({ [styles.SELECTED_CLASSNAME]: isSelected })}
css={styles.planAwardIconSelectOption}
onClick={handleClick}
>
<PlanAwardIcon
icon={icon}
size={40}
/>
</UnstyledButton>
);
});
|