2018-07-17 13:11:13 +00:00
|
|
|
/** @format */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import './style.scss';
|
|
|
|
|
2018-08-31 17:27:21 +00:00
|
|
|
/**
|
|
|
|
* Use `OrderStatus` to display a badge with human-friendly text describing the current order status.
|
|
|
|
*
|
|
|
|
* @return { object } -
|
|
|
|
*/
|
2018-07-17 13:11:13 +00:00
|
|
|
const OrderStatus = ( { order, className } ) => {
|
|
|
|
const { status } = order;
|
|
|
|
const { orderStatuses } = wcSettings;
|
|
|
|
const classes = classnames( 'woocommerce-order-status', className );
|
|
|
|
const indicatorClasses = classnames( 'woocommerce-order-status__indicator', {
|
|
|
|
[ 'is-' + status ]: true,
|
|
|
|
} );
|
|
|
|
const label = orderStatuses[ 'wc-' + status ] || status;
|
|
|
|
return (
|
|
|
|
<div className={ classes }>
|
|
|
|
<span className={ indicatorClasses } />
|
|
|
|
{ label }
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
OrderStatus.propTypes = {
|
2018-08-31 17:27:21 +00:00
|
|
|
/**
|
|
|
|
* The order to display a status for.
|
|
|
|
*/
|
2018-07-17 13:11:13 +00:00
|
|
|
order: PropTypes.object.isRequired,
|
2018-08-31 17:27:21 +00:00
|
|
|
/**
|
|
|
|
* Additional CSS classes.
|
|
|
|
*/
|
2018-07-17 13:11:13 +00:00
|
|
|
className: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default OrderStatus;
|