UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

31 lines (28 loc) 1.36 kB
import React, { PureComponent } from 'react'; import cx from 'classnames'; const Card = ({ children, className, legacy, responsive, }) => (React.createElement("div", { className: cx("cobalt-Card", className, { "cobalt-Card--legacy": legacy, "cobalt-Card--responsive": responsive, }) }, 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 (React.createElement("a", { className: getClasses(baseProps), href: href, target: target, rel: target && !rel ? "noopener noreferrer" : rel }, baseProps.children)); }; CardSectionLink.displayName = "CardSection.Link"; class CardSection extends PureComponent { render() { return React.createElement("div", { className: getClasses(this.props) }, this.props.children); } } CardSection.Link = CardSectionLink; Card.Section = CardSection; export { Card, CardSection, Card as default }; //# sourceMappingURL=index.js.map