design-react-kit
Version:
Componenti React per Bootstrap 5
25 lines • 1.45 kB
JavaScript
import React from 'react';
import classNames from 'classnames';
import { Icon } from '../Icon/Icon';
export const CardCategory = ({ iconName, iconTitle, date, href, onClick, testId, children, textDescription, dateDescription, ...rest }) => {
const classes = classNames({
'category-top': date || ' ',
'categoryicon-top': iconName
});
// Simple category link
const categoryLink = !iconName && (React.createElement(React.Fragment, null,
textDescription && React.createElement("span", { className: 'visually-hidden' }, textDescription),
React.createElement("a", { href: href, className: 'category', onClick: onClick }, children)));
const categoryDate = date && React.createElement("span", { className: 'data' }, date);
// Category with icon
const categoryText = iconName && React.createElement("span", { className: 'text' }, children);
const categoryIcon = iconName && React.createElement(Icon, { icon: iconName, title: iconTitle });
return (React.createElement("div", { className: classes, ...rest, "data-testid": testId },
categoryLink,
categoryIcon,
categoryText && textDescription && React.createElement("span", { className: 'visually-hidden' }, textDescription),
categoryText,
dateDescription && React.createElement("span", { className: 'visually-hidden' }, dateDescription),
categoryDate));
};
//# sourceMappingURL=CardCategory.js.map