/** @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 } from 'components/section'; import { validateComponent } from 'lib/proptype-validator'; /** * A header component. The header can contain a title, actions via children, and an `EllipsisMenu` menu. */ class SectionHeader extends Component { render() { const { children, menu, title } = this.props; const className = classnames( 'woocommerce-section-header', this.props.className ); return (
{ title }
{ children && (
{ children }
) } { menu && (
{ menu }
) }
); } } SectionHeader.propTypes = { /** * Additional CSS classes. */ className: PropTypes.string, /** * An `EllipsisMenu`, with filters used to control the content visible in this card */ menu: validateComponent( EllipsisMenu ), /** * The title to use for this card. */ title: PropTypes.oneOfType( [ PropTypes.string, PropTypes.node ] ).isRequired, }; export default SectionHeader;