design-react-kit
Version:
Componenti React per Bootstrap 5
18 lines • 820 B
JavaScript
import React from 'react';
import classNames from 'classnames';
export const SkiplinkItem = ({ className, tag = 'a', focusable = true, navItem = false, testId, ...attributes }) => {
const Tag = tag;
const classes = classNames(className, {
'visually-hidden-focusable': focusable
});
// Add an extra href for focusable if the user passes an onClick rather than href prop
const extraHref = attributes.onClick ? { href: '#' } : {};
if (navItem) {
return (React.createElement("li", { className: classes },
React.createElement(Tag, { ...attributes, ...extraHref, "data-testid": testId })));
}
else {
return React.createElement(Tag, { className: classes, ...attributes, ...extraHref, "data-testid": testId });
}
};
//# sourceMappingURL=SkiplinkItem.js.map