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

View File

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

View File

@ -8,6 +8,7 @@ import ChevronDownIcon from 'gridicons/dist/chevron-down';
import { isNil, noop } from 'lodash';
import PropTypes from 'prop-types';
import { createElement } from '@wordpress/element';
import { Icon, info } from '@wordpress/icons';
/**
* Internal dependencies
@ -25,6 +26,7 @@ import { Text } from '../experimental';
* @param {string} props.hrefType
* @param {boolean} props.isOpen
* @param {string} props.label
* @param {string} props.labelTooltipText
* @param {Function} props.onToggle
* @param {string} props.prevLabel
* @param {number|string} props.prevValue
@ -41,6 +43,7 @@ const SummaryNumber = ( {
hrefType,
isOpen,
label,
labelTooltipText,
onToggle,
prevLabel,
prevValue,
@ -107,6 +110,20 @@ const SummaryNumber = ( {
<Text variant="body.small" size="14" lineHeight="20px">
{ label }
</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 className="woocommerce-summary__item-data">
@ -179,6 +196,10 @@ SummaryNumber.propTypes = {
* A string description of this value, ex "Revenue", or "New Customers"
*/
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.
*/

View File

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