design-react-kit
Version:
Componenti React per Bootstrap 5
20 lines • 1.27 kB
JavaScript
import React from 'react';
import classNames from 'classnames';
import { Icon } from '../Icon/Icon';
export const BottomNavItem = ({ active = false, badge, alert = false, url, to, srText, iconName = 'it-comment', label, tag = 'a', onLinkClick, link, testId, ...attributes }) => {
const Tag = tag;
const activeClass = classNames({ active });
const badgeWrapper = Boolean(badge) && (React.createElement("div", { className: 'badge-wrapper' },
React.createElement("span", { className: 'bottom-nav-badge' }, badge)));
const alertWrapper = Boolean(alert) && (React.createElement("div", { className: 'badge-wrapper' },
React.createElement("span", { className: 'bottom-nav-alert' })));
return (React.createElement("li", { ...attributes, "data-testid": testId },
React.createElement(Tag, { href: url || link || '#', className: activeClass, to: to, onClick: onLinkClick },
badgeWrapper,
alertWrapper,
React.createElement(Icon, { icon: iconName }),
React.createElement("span", { className: 'bottom-nav-label' },
label,
srText ? React.createElement("span", { className: 'visually-hidden' }, srText) : null))));
};
//# sourceMappingURL=BottomNavItem.js.map