Skip to content

The open alternative to Salesforce, designed for AI.

1.1 KB
Raw Blame
import { styled } from '@linaria/react';
import { RadioGroup } from 'twenty-ui/primitives/input';
import { SettingsRadioCard } from '@/settings/components/SettingsRadioCard';
import { type IconComponent } from 'twenty-ui/icon';
import { themeCssVariables } from 'twenty-ui/theme';

const StyledRadioCardContainer = styled.div`
  flex-wrap: wrap;
  gap: ${themeCssVariables.spacing[4]};
`;

type SettingsRadioCardContainerProps = {
  onChange: (value: string) => void;
  value: string;
  options: Array<{
    value: string;
    title: string;
    description?: string;
    Icon?: IconComponent;
  }>;
};

export const SettingsRadioCardContainer = ({
  options,
  value,
  onChange,
}: SettingsRadioCardContainerProps) => {
  return (
    <RadioGroup
      orientation="horizontal"
      value={value}
      onValueChange={onChange}
      render={<StyledRadioCardContainer />}
    >
      {options.map((option) => (
        <SettingsRadioCard
          key={option.value}
          value={option.value}
          title={option.title}
          description={option.description}
          Icon={option.Icon}
        />
      ))}
    </RadioGroup>
  );
};