2018-07-20 18:41:39 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2024-05-31 03:49:36 +00:00
|
|
|
import clsx from 'clsx';
|
2018-07-20 18:41:39 +00:00
|
|
|
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;
|
2024-05-31 03:49:36 +00:00
|
|
|
const cardClassName = clsx(
|
2020-02-14 02:23:21 +00:00
|
|
|
'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;
|