import React, { FunctionComponent, AllHTMLAttributes, ReactNode } from 'react'; import Tappable, { TappableProps } from '../Tappable/Tappable'; import { getClassName } from '../../helpers/getClassName'; import { classNames } from '../../lib/classNames'; import { usePlatform } from '../../hooks/usePlatform'; import { isPrimitiveReactNode } from '../../lib/utils'; import { IOS, VKCOM } from '../../lib/platform'; import Text from '../Typography/Text/Text'; import Title from '../Typography/Title/Title'; interface ButtonTypographyProps extends AllHTMLAttributes { primary?: PanelHeaderButtonProps['primary']; } const ButtonTypography: FunctionComponent = ({ primary, children }: ButtonTypographyProps) => { const platform = usePlatform(); if (platform === IOS) { return ( {children} ); } return ( {children} ); }; export interface PanelHeaderButtonProps extends Omit { primary?: boolean; label?: ReactNode; } const PanelHeaderButton: FunctionComponent = ({ className, children, primary, label, ...restProps }: PanelHeaderButtonProps) => { const isPrimitive = isPrimitiveReactNode(children); const isPrimitiveLabel = isPrimitiveReactNode(label); const Component = restProps.href ? 'a' : 'button'; const platform = usePlatform(); return ( {isPrimitive ? {children} : children } {isPrimitiveLabel ? {label} : label } ); }; PanelHeaderButton.defaultProps = { primary: false, }; export default PanelHeaderButton;