Adding tooltip to describe the lack of refund deductions from revenue summaries (https://github.com/woocommerce/woocommerce-admin/pull/8187)

This commit is contained in:
Joel Thiessen 2022-01-18 12:07:32 -08:00 committed by GitHub
parent 3c424992a4
commit 96c7eb4e26
5 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: Add
Adding tooltip to describe the lack of refund deductions from revenue summaries. #8187

View File

@ -82,6 +82,7 @@ export class ReportSummary extends Component {
label, label,
type, type,
isReverseTrend, isReverseTrend,
labelTooltipText,
} = chart; } = chart;
const newPath = { chart: key }; const newPath = { chart: key };
if ( orderby ) { if ( orderby ) {
@ -109,6 +110,7 @@ export class ReportSummary extends Component {
prevValue={ prevValue } prevValue={ prevValue }
selected={ isSelected } selected={ isSelected }
value={ value } value={ value }
labelTooltipText={ labelTooltipText }
onLinkClickCallback={ () => { onLinkClickCallback={ () => {
// Wider than a certain breakpoint, there is no dropdown so avoid calling onToggle. // Wider than a certain breakpoint, there is no dropdown so avoid calling onToggle.
if ( onToggle ) { if ( onToggle ) {

View File

@ -41,6 +41,10 @@ export const charts = applyFilters( REVENUE_REPORT_CHARTS_FILTER, [
orderby: 'net_revenue', orderby: 'net_revenue',
type: 'currency', type: 'currency',
isReverseTrend: false, isReverseTrend: false,
labelTooltipText: __(
'Full refunds are not deducted from tax or net sales totals',
'woocommerce-admin'
),
}, },
{ {
key: 'taxes', key: 'taxes',
@ -49,6 +53,10 @@ export const charts = applyFilters( REVENUE_REPORT_CHARTS_FILTER, [
orderby: 'taxes', orderby: 'taxes',
type: 'currency', type: 'currency',
isReverseTrend: false, isReverseTrend: false,
labelTooltipText: __(
'Full refunds are not deducted from tax or net sales totals',
'woocommerce-admin'
),
}, },
{ {
key: 'shipping', key: 'shipping',

View File

@ -8,6 +8,7 @@ import ChevronDownIcon from 'gridicons/dist/chevron-down';
import { isNil, noop } from 'lodash'; import { isNil, noop } from 'lodash';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { createElement } from '@wordpress/element'; import { createElement } from '@wordpress/element';
import { Icon, info } from '@wordpress/icons';
/** /**
* Internal dependencies * Internal dependencies
@ -25,6 +26,7 @@ import { Text } from '../experimental';
* @param {string} props.hrefType * @param {string} props.hrefType
* @param {boolean} props.isOpen * @param {boolean} props.isOpen
* @param {string} props.label * @param {string} props.label
* @param {string} props.labelTooltipText
* @param {Function} props.onToggle * @param {Function} props.onToggle
* @param {string} props.prevLabel * @param {string} props.prevLabel
* @param {number|string} props.prevValue * @param {number|string} props.prevValue
@ -41,6 +43,7 @@ const SummaryNumber = ( {
hrefType, hrefType,
isOpen, isOpen,
label, label,
labelTooltipText,
onToggle, onToggle,
prevLabel, prevLabel,
prevValue, prevValue,
@ -107,6 +110,20 @@ const SummaryNumber = ( {
<Text variant="body.small" size="14" lineHeight="20px"> <Text variant="body.small" size="14" lineHeight="20px">
{ label } { label }
</Text> </Text>
{ labelTooltipText && (
<Tooltip
text={ labelTooltipText }
position="top center"
>
<div className="woocommerce-summary__info-tooltip">
<Icon
width={ 20 }
height={ 20 }
icon={ info }
/>
</div>
</Tooltip>
) }
</div> </div>
<div className="woocommerce-summary__item-data"> <div className="woocommerce-summary__item-data">
@ -179,6 +196,10 @@ SummaryNumber.propTypes = {
* A string description of this value, ex "Revenue", or "New Customers" * A string description of this value, ex "Revenue", or "New Customers"
*/ */
label: PropTypes.string.isRequired, label: PropTypes.string.isRequired,
/**
* A string that will displayed via a Tooltip next to the label
*/
labelTooltipText: PropTypes.string,
/** /**
* A function used to switch the given SummaryNumber to a button, and called on click. * A function used to switch the given SummaryNumber to a button, and called on click.
*/ */

View File

@ -315,12 +315,22 @@ $border: $gray-200;
} }
.woocommerce-summary__item-label { .woocommerce-summary__item-label {
display: block; display: flex;
margin-bottom: $gap; margin-bottom: $gap;
color: $gray-700; color: $gray-700;
} }
.woocommerce-summary__info-tooltip {
color: $gray-600;
line-height: 1em;
margin-left: $gap-smallest;
svg {
fill: currentColor;
}
}
.woocommerce-summary__item-value { .woocommerce-summary__item-value {
margin-bottom: $gap-smallest; margin-bottom: $gap-smallest;
font-weight: 500; font-weight: 500;