@drivy/cobalt
Version:
Opinionated design system for Drivy's projects.
32 lines (29 loc) • 1.38 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import cx from 'classnames';
import { PureComponent } from 'react';
const Card = ({ children, className, legacy, responsive, }) => (jsx("div", { className: cx("cobalt-Card", className, {
"cobalt-Card--legacy": legacy,
"cobalt-Card--responsive": responsive,
}), children: children }));
const getClasses = ({ className = "", tabBar, tight, subdued, divided, }) => {
return cx(className, "cobalt-Card__Section", {
"cobalt-Card__Section--tabBar": tabBar === true,
"cobalt-Card__Section--tight": tight === true,
"cobalt-Card__Section--subdued": subdued === true,
"cobalt-Card__Section--divided": divided === true,
"cobalt-Card__Section--dividedSoft": divided === "soft",
});
};
const CardSectionLink = ({ href, target, rel, ...baseProps }) => {
return (jsx("a", { className: getClasses(baseProps), href: href, target: target, rel: target && !rel ? "noopener noreferrer" : rel, children: baseProps.children }));
};
CardSectionLink.displayName = "CardSection.Link";
class CardSection extends PureComponent {
render() {
return jsx("div", { className: getClasses(this.props), children: this.props.children });
}
}
CardSection.Link = CardSectionLink;
Card.Section = CardSection;
export { Card, CardSection, Card as default };
//# sourceMappingURL=index.js.map