UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

50 lines (49 loc) 1.82 kB
import { jsx } from "react/jsx-runtime"; import classnames from "classnames"; import { PureComponent } from "react"; function _define_property(obj, key, value) { if (key in obj) Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); else obj[key] = value; return obj; } const Card = ({ children, className, legacy, responsive })=>/*#__PURE__*/ jsx("div", { className: classnames("cobalt-Card", className, { "cobalt-Card--legacy": legacy, "cobalt-Card--responsive": responsive }), children: children }); const getClasses = ({ className = "", tabBar, tight, subdued, divided })=>classnames(className, "cobalt-Card__Section", { "cobalt-Card__Section--tabBar": true === tabBar, "cobalt-Card__Section--tight": true === tight, "cobalt-Card__Section--subdued": true === subdued, "cobalt-Card__Section--divided": true === divided, "cobalt-Card__Section--dividedSoft": "soft" === divided }); const CardSectionLink = ({ href, target, rel, ...baseProps })=>/*#__PURE__*/ 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 /*#__PURE__*/ jsx("div", { className: getClasses(this.props), children: this.props.children }); } } _define_property(CardSection, "Link", CardSectionLink); Card.Section = CardSection; const components_Card = Card; export default components_Card; export { Card, CardSection }; //# sourceMappingURL=index.js.map