import React from 'react'; import { Box, Flex, useTheme, Grid, type GridProps, HStack } from '@chakra-ui/react'; import { useTranslation } from 'next-i18next'; import QuestionTip from '../MyTooltip/QuestionTip'; type Props = Omit & { list: { title: string | React.ReactNode; desc?: string; value: T; children?: React.ReactNode; tooltip?: string; }[]; align?: 'flex-top' | 'center'; value: T; defaultBg?: string; activeBg?: string; onChange: (e: T) => void; }; const LeftRadio = ({ list, value, align = 'flex-top', px = 3.5, py = 4, defaultBg = 'myGray.50', activeBg = 'primary.50', onChange, ...props }: Props) => { const { t } = useTranslation(); const theme = useTheme(); return ( {list.map((item) => ( 1 ? 'primary.400' : '', bg: activeBg, boxShadow: list.length > 1 ? 'focus' : 'none' } : { bg: defaultBg, _hover: { borderColor: 'primary.300' } })} onClick={() => onChange(item.value)} > {/* Circle */} {list.length > 1 && ( )} {typeof item.title === 'string' ? ( {t(item.title as any)} {!!item.tooltip && } ) : ( item.title )} {!!item.desc && ( {t(item.desc as any)} )} {item?.children && ( {item?.children} )} ))} ); }; export default LeftRadio;