/** * External dependencies */ import clsx from 'clsx'; /** * Internal dependencies */ import './choice.scss'; type Props = { className?: string; selected: boolean; title: string; subtitle?: string; name: string; value: string; onChange: ( value: string ) => void; }; export const Choice = ( { className, selected, title, subtitle, name, value, onChange, }: Props ) => { const changeHandler = () => { onChange( value ); }; const inputId = 'woocommerce-' + value.replace( /_/g, '-' ); return (
{ if ( e.key === 'Enter' ) { changeHandler(); } } } data-selected={ selected ? selected : null } tabIndex={ 0 } >
{ subtitle &&

{ subtitle }

}
); };