2018-07-20 18:41:39 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import { Component } from '@wordpress/element';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { range } from 'lodash';
|
|
|
|
|
|
|
|
class ActivityCardPlaceholder extends Component {
|
|
|
|
render() {
|
2022-06-21 08:37:34 +00:00
|
|
|
const { className, hasAction, hasDate, hasSubtitle, lines } =
|
|
|
|
this.props;
|
2020-02-14 02:23:21 +00:00
|
|
|
const cardClassName = classnames(
|
|
|
|
'woocommerce-activity-card is-loading',
|
|
|
|
className
|
|
|
|
);
|
2018-07-20 18:41:39 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={ cardClassName } aria-hidden>
|
|
|
|
<span className="woocommerce-activity-card__icon">
|
|
|
|
<span className="is-placeholder" />
|
|
|
|
</span>
|
|
|
|
<div className="woocommerce-activity-card__header">
|
|
|
|
<div className="woocommerce-activity-card__title is-placeholder" />
|
2020-02-14 02:23:21 +00:00
|
|
|
{ hasSubtitle && (
|
|
|
|
<div className="woocommerce-activity-card__subtitle is-placeholder" />
|
|
|
|
) }
|
2018-07-20 18:41:39 +00:00
|
|
|
{ hasDate && (
|
|
|
|
<div className="woocommerce-activity-card__date">
|
|
|
|
<span className="is-placeholder" />
|
|
|
|
</div>
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
<div className="woocommerce-activity-card__body">
|
2020-02-14 02:23:21 +00:00
|
|
|
{ range( lines ).map( ( i ) => (
|
|
|
|
<span className="is-placeholder" key={ i } />
|
|
|
|
) ) }
|
2018-07-20 18:41:39 +00:00
|
|
|
</div>
|
|
|
|
{ hasAction && (
|
|
|
|
<div className="woocommerce-activity-card__actions">
|
|
|
|
<span className="is-placeholder" />
|
|
|
|
</div>
|
|
|
|
) }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ActivityCardPlaceholder.propTypes = {
|
|
|
|
className: PropTypes.string,
|
|
|
|
hasAction: PropTypes.bool,
|
|
|
|
hasDate: PropTypes.bool,
|
|
|
|
hasSubtitle: PropTypes.bool,
|
|
|
|
lines: PropTypes.number,
|
|
|
|
};
|
|
|
|
|
|
|
|
ActivityCardPlaceholder.defaultProps = {
|
|
|
|
hasAction: false,
|
|
|
|
hasDate: false,
|
|
|
|
hasSubtitle: false,
|
|
|
|
lines: 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ActivityCardPlaceholder;
|