import { Stack, Card, Text, Flex } from '@mantine/core'; import { Tooltip } from './Tooltip'; import { useTranslation } from 'react-i18next'; export interface CardOption { value: T; prefixKey: string; nameKey: string; tooltipKey?: string; tooltipContent?: any[]; } export interface CardSelectorProps> { options: K[]; onSelect: (value: T) => void; disabled?: boolean; getTooltipContent?: (option: K) => any[]; } const CardSelector = >({ options, onSelect, disabled = false, getTooltipContent }: CardSelectorProps) => { const { t } = useTranslation(); const handleOptionClick = (value: T) => { if (!disabled) { onSelect(value); } }; const getTooltips = (option: K) => { if (getTooltipContent) { return getTooltipContent(option); } return []; }; return ( {options.map((option) => ( { if (!disabled) { e.currentTarget.style.backgroundColor = 'var(--mantine-color-gray-3)'; e.currentTarget.style.transform = 'translateY(-1px)'; e.currentTarget.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.1)'; } }} onMouseLeave={(e) => { if (!disabled) { e.currentTarget.style.backgroundColor = 'var(--mantine-color-gray-2)'; e.currentTarget.style.transform = 'translateY(0px)'; e.currentTarget.style.boxShadow = 'none'; } }} onClick={() => handleOptionClick(option.value)} > {t(option.prefixKey, "Prefix")} {t(option.nameKey, "Option Name")} ))} ); }; export default CardSelector;