woocommerce/plugins/woocommerce-admin/client/components/count/index.js

34 lines
557 B
JavaScript
Raw Normal View History

2018-05-21 00:12:40 +00:00
/** @format */
/**
* External dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
2018-05-21 00:12:40 +00:00
import PropTypes from 'prop-types';
/**
* Internal dependencies
*/
import './style.scss';
const Count = ( { count, label } ) => {
if ( ! label ) {
label = sprintf( __( 'Total %d', 'woo-dash' ), count );
}
return (
<span className="woocommerce-count" aria-label={ label }>
{ count }
</span>
);
2018-05-21 00:12:40 +00:00
};
Count.propTypes = {
count: PropTypes.number.isRequired,
label: PropTypes.string,
};
Count.defaultProps = {
label: '',
2018-05-21 00:12:40 +00:00
};
export default Count;