import React from 'react'; import { CustomRadio, RadioGroup, type RadioGroupProps, } from '../RadioGroup/RadioGroup.quanta'; import { ImagewideIcon } from '../../components/icons/ImagewideIcon'; import { ImagefitIcon } from '../../components/icons/ImagefitIcon'; import { ImagefullIcon } from '../../components/icons/ImagefullIcon'; import { ImagenarrowIcon } from '../../components/icons/ImagenarrowIcon'; interface WidthWidgetProps extends Omit { id?: string; actions?: string[]; actionsInfoMap?: Record, string]>; } export const defaultActionsInfo: Record< string, [React.ComponentType, string] > = { narrow: [ImagenarrowIcon, 'Narrow'], default: [ImagefitIcon, 'Default'], layout: [ImagewideIcon, 'Layout'], full: [ImagefullIcon, 'Full'], }; export function WidthWidget(props: WidthWidgetProps) { const { // eslint-disable-next-line @typescript-eslint/no-unused-vars id, onChange, actions = ['narrow', 'default', 'layout', 'full'], actionsInfoMap, ...radioGroupProps } = props; const actionsInfo = { ...defaultActionsInfo, ...actionsInfoMap, }; const handleChange = (selectedValue: string) => { if (onChange) { onChange(selectedValue); } }; return ( {actions.map((action) => { const [IconComponent, label] = actionsInfo[action]; return ( ); })} ); }