import type { ChangeEvent, MouseEventHandler } from 'react'; import type { FC, TeactNode } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact'; import buildClassName from '../../util/buildClassName'; import useOldLang from '../../hooks/useOldLang'; import Spinner from './Spinner'; import './Radio.scss'; type OwnProps = { id?: string; name?: string; label?: TeactNode; subLabel?: TeactNode; value?: string; checked?: boolean; disabled?: boolean; isLink?: boolean; hidden?: boolean; isLoading?: boolean; withIcon?: boolean; className?: string; onlyInput?: boolean; subLabelClassName?: string; onChange?: (e: ChangeEvent) => void; onSubLabelClick?: MouseEventHandler | undefined; }; const Radio: FC = ({ id, label, subLabel, subLabelClassName, value, name, checked, disabled, hidden, isLoading, className, onlyInput, withIcon, isLink, onChange, onSubLabelClick, }) => { const lang = useOldLang(); const fullClassName = buildClassName( 'Radio', className, disabled && 'disabled', hidden && 'hidden-widget', withIcon && 'with-icon', isLoading && 'loading', onlyInput && 'onlyInput', Boolean(subLabel) && 'withSubLabel', ); return ( ); }; export default memo(Radio);