UNPKG

@woocommerce/components

Version:
52 lines (51 loc) 1.94 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /** * External dependencies */ const element_1 = require("@wordpress/element"); const components_1 = require("@wordpress/components"); const clsx_1 = __importDefault(require("clsx")); const prop_types_1 = __importDefault(require("prop-types")); /** * Internal dependencies */ const link_1 = __importDefault(require("../link")); const AbbreviatedCard = ({ children, className, href, icon, onClick, type, }) => { return ((0, element_1.createElement)(components_1.Card, { className: (0, clsx_1.default)('woocommerce-abbreviated-card', className) }, (0, element_1.createElement)(components_1.CardBody, { size: null }, (0, element_1.createElement)(link_1.default, { href: href, onClick: onClick, type: type }, (0, element_1.createElement)("div", { className: "woocommerce-abbreviated-card__icon" }, (0, element_1.createElement)(components_1.Icon, { icon: icon })), (0, element_1.createElement)("div", { className: "woocommerce-abbreviated-card__content" }, children))))); }; AbbreviatedCard.propTypes = { /** * The Abbreviated Card content. */ children: prop_types_1.default.node.isRequired, /** * Additional CSS classes. */ className: prop_types_1.default.string, /** * The resource to link to. */ href: prop_types_1.default.string.isRequired, /** * Icon for the Abbreviated Card. */ icon: prop_types_1.default.element.isRequired, /** * Called when the card is clicked. */ onClick: prop_types_1.default.func, /** * Type of link. */ type: prop_types_1.default.oneOf(['wp-admin', 'wc-admin', 'external']), }; exports.default = AbbreviatedCard;