/** @format */ /** * External dependencies */ import { __, sprintf } from '@wordpress/i18n'; import classnames from 'classnames'; import Gridicon from 'gridicons'; import { isUndefined } from 'lodash'; import PropTypes from 'prop-types'; /** * External dependencies */ import Link from 'components/link'; const SummaryNumber = ( { delta, href, label, prevLabel, prevValue, reverseTrend, selected, value, } ) => { const classes = classnames( 'woocommerce-summary__item', { 'is-selected': selected, 'is-good-trend': reverseTrend ? delta < 0 : delta > 0, 'is-bad-trend': reverseTrend ? delta > 0 : delta < 0, } ); let icon = delta > 0 ? 'arrow-up' : 'arrow-down'; let screenReaderLabel = delta > 0 ? sprintf( __( 'Up %d%% from %s', 'wc-admin' ), delta, prevLabel ) : sprintf( __( 'Down %d%% from %s', 'wc-admin' ), Math.abs( delta ), prevLabel ); if ( ! delta ) { // delta is zero or falsey icon = 'arrow-right'; screenReaderLabel = sprintf( __( 'No change from %s', 'wc-admin' ), prevLabel ); } return (