import React, { FunctionComponent, ReactNode, HTMLAttributes, ElementType, AnchorHTMLAttributes } from 'react'; import { getClassName } from '../../helpers/getClassName'; import Counter from '../Counter/Counter'; import { classNames } from '../../lib/classNames'; import { usePlatform } from '../../hooks/usePlatform'; import { hasReactNode } from '../../lib/utils'; export interface TabbarItemProps extends HTMLAttributes, AnchorHTMLAttributes { selected?: boolean; /** * Тест рядом с иконкой */ text?: ReactNode; /** * Индикатор над иконкой. Принимает `` или `` */ indicator?: ReactNode; /** * @deprecated будет удалено в 5.0.0. Используйте `indicator` */ label?: ReactNode; } const TabbarItem: FunctionComponent = (props: TabbarItemProps) => { const { className, children, selected, label, indicator, text, ...restProps } = props; const platform = usePlatform(); const Component: ElementType = restProps.href ? 'a' : 'div'; return (
{children}
{hasReactNode(indicator) && indicator} {!indicator && label && {label}}
{text &&
{text}
}
); }; export default TabbarItem;