import React from 'react'; import { Box, Flex, useTheme, Grid, type GridProps, HStack } from '@chakra-ui/react'; import { useTranslation } from 'next-i18next'; import MyTooltip from '../MyTooltip'; import QuestionTip from '../MyTooltip/QuestionTip'; // @ts-ignore interface Props extends GridProps { list: { title: string; desc?: string; value: any; children?: React.ReactNode; tooltip?: string; }[]; align?: 'flex-top' | 'center'; value: any; defaultBg?: string; activeBg?: string; onChange: (e: any) => void; } const LeftRadio = ({ list, value, align = 'flex-top', px = 3, py = 4, defaultBg = 'myGray.50', activeBg = 'primary.50', onChange, ...props }: Props) => { const { t } = useTranslation(); const theme = useTheme(); return ( {list.map((item) => ( onChange(item.value)} > {typeof item.title === 'string' ? t(item.title as any) : item.title} {!!item.tooltip && } {!!item.desc && ( {t(item.desc as any)} )} {item?.children} ))} ); }; export default LeftRadio;