2021-10-29 02:35:17 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { Icon, miniCart } from '@woocommerce/icons';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import './style.scss';
|
|
|
|
|
2021-11-17 15:39:07 +00:00
|
|
|
interface Props {
|
|
|
|
count: number;
|
|
|
|
colorClassNames?: string;
|
|
|
|
style?: Record< string, string | undefined >;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QuantityBadge = ( {
|
|
|
|
count,
|
|
|
|
colorClassNames,
|
|
|
|
style,
|
|
|
|
}: Props ): JSX.Element => {
|
|
|
|
return (
|
|
|
|
<span className="wc-block-mini-cart__quantity-badge">
|
|
|
|
<Icon
|
|
|
|
className="wc-block-mini-cart__icon"
|
|
|
|
size={ 20 }
|
|
|
|
srcElement={ miniCart }
|
|
|
|
/>
|
|
|
|
<span
|
|
|
|
className={ `wc-block-mini-cart__badge ${ colorClassNames }` }
|
|
|
|
style={ style }
|
|
|
|
>
|
|
|
|
{ count }
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
};
|
2021-10-29 02:35:17 +00:00
|
|
|
|
|
|
|
export default QuantityBadge;
|