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