import React, { FunctionComponent, InputHTMLAttributes, ReactNode } from 'react'; import Tappable, { ACTIVE_EFFECT_DELAY } from '../Tappable/Tappable'; import { getClassName } from '../../helpers/getClassName'; import { classNames } from '../../lib/classNames'; import { IOS, VKCOM } from '../../lib/platform'; import { HasRef, HasRootRef } from '../../types'; import { usePlatform } from '../../hooks/usePlatform'; import { withAdaptivity, AdaptivityProps, SizeType } from '../../hoc/withAdaptivity'; import { hasReactNode } from '../../lib/utils'; import Caption from '../../components/Typography/Caption/Caption'; import Headline from '../Typography/Headline/Headline'; import Text from '../Typography/Text/Text'; export interface RadioProps extends InputHTMLAttributes, HasRef, HasRootRef, AdaptivityProps { description?: ReactNode; } const Radio: FunctionComponent = (props: RadioProps) => { const { children, description, style, className, getRef, getRootRef, sizeY, ...restProps } = props; const platform = usePlatform(); const ContentComponent = platform === VKCOM || sizeY === SizeType.COMPACT ? Text : Headline; const descriptionLevel = platform === VKCOM || sizeY === SizeType.COMPACT ? '2' : '1'; return (
{children}
{hasReactNode(description) && {description}}
); }; export default withAdaptivity(Radio, { sizeY: true, });