/** @format */ /** * External dependencies */ import classnames from 'classnames'; import { cloneElement, Component } from '@wordpress/element'; import Gridicon from 'gridicons'; import { isArray } from 'lodash'; import { moment } from '@wordpress/date'; import PropTypes from 'prop-types'; /** * Internal dependencies */ import './style.scss'; import { H, Section } from 'layout/section'; class ActivityCard extends Component { render() { const { actions, className, children, date, icon, subtitle, title, unread } = this.props; const cardClassName = classnames( 'woocommerce-activity-card', className ); const actionsList = isArray( actions ) ? actions : [ actions ]; return (
{ unread && } { icon }
{ title } { subtitle &&
{ subtitle }
} { date && ( { moment( date ).fromNow() } ) }
{ children }
{ actions && ( ) }
); } } ActivityCard.propTypes = { actions: PropTypes.oneOfType( [ PropTypes.arrayOf( PropTypes.element ), PropTypes.element ] ), className: PropTypes.string, children: PropTypes.node.isRequired, date: PropTypes.string, icon: PropTypes.node, subtitle: PropTypes.node, title: PropTypes.string.isRequired, unread: PropTypes.bool, }; ActivityCard.defaultProps = { icon: , unread: false, }; export { ActivityCard }; export { default as ActivityCardPlaceholder } from './placeholder';