import styled from '@emotion/styled'; import { ReactNode } from 'react'; import { Card, CardContent, Radio } from 'twenty-ui'; type SettingsAccountsRadioSettingsCardProps = { onChange: (nextValue: Option['value']) => void; options: Option[]; value: Option['value']; name: string; }; const StyledCardContent = styled(CardContent)` align-items: center; display: flex; gap: ${({ theme }) => theme.spacing(4)}; cursor: pointer; &:hover { background: ${({ theme }) => theme.background.transparent.lighter}; } `; const StyledTitle = styled.div` color: ${({ theme }) => theme.font.color.primary}; font-weight: ${({ theme }) => theme.font.weight.medium}; margin-bottom: ${({ theme }) => theme.spacing(2)}; `; const StyledDescription = styled.div` color: ${({ theme }) => theme.font.color.tertiary}; font-size: ${({ theme }) => theme.font.size.sm}; `; const StyledRadio = styled(Radio)` margin-left: auto; `; export const SettingsAccountsRadioSettingsCard = < Option extends { cardMedia: ReactNode; description: string; title: string; value: string; }, >({ onChange, options, value, name, }: SettingsAccountsRadioSettingsCardProps) => ( {options.map((option, index) => ( onChange(option.value)} > {option.cardMedia} {option.title} {option.description} onChange(option.value)} checked={value === option.value} /> ))} );