/** @format */ /** * External dependencies */ import { Component } from '@wordpress/element'; import classnames from 'classnames'; import PropTypes from 'prop-types'; /** * Internal dependencies */ import './style.scss'; import EllipsisMenu from 'components/ellipsis-menu'; import { H, Section } from 'layout/section'; import { validateComponent } from 'lib/proptype-validator'; class Card extends Component { render() { const { action, children, menu, title } = this.props; const className = classnames( 'woocommerce-card', this.props.className, { 'has-menu': !! menu, 'has-action': !! action, } ); return (
{ title } { action &&
{ action }
} { menu &&
{ menu }
}
{ children }
); } } Card.propTypes = { action: PropTypes.node, className: PropTypes.string, menu: validateComponent( EllipsisMenu ), title: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node ] ).isRequired, }; export default Card;