diff --git a/client/my-sites/stats/stats-subscribers-highlight-section/index.tsx b/client/my-sites/stats/stats-subscribers-highlight-section/index.tsx index 4867afa9639ab..38594ee7058ae 100644 --- a/client/my-sites/stats/stats-subscribers-highlight-section/index.tsx +++ b/client/my-sites/stats/stats-subscribers-highlight-section/index.tsx @@ -84,6 +84,8 @@ function SubscriberHighlightsStandard( { highlights, isLoading, }: SubscriberHighlightsRenderProps ) { + const translate = useTranslate(); + return (
{ highlights.map( ( highlight ) => ( @@ -91,6 +93,7 @@ function SubscriberHighlightsStandard( { heading={ isLoading ? '-' : highlight.heading } key={ highlight.heading } showValueTooltip + label={ translate( 'subscribers' ) } note={ highlight.note } value={ isLoading ? null : highlight.count } /> diff --git a/client/my-sites/stats/stats-subscribers-overview/index.tsx b/client/my-sites/stats/stats-subscribers-overview/index.tsx index 202d565e0cfff..ed12c1838e80d 100644 --- a/client/my-sites/stats/stats-subscribers-overview/index.tsx +++ b/client/my-sites/stats/stats-subscribers-overview/index.tsx @@ -1,4 +1,5 @@ import { CountCard } from '@automattic/components'; +import { useTranslate } from 'i18n-calypso'; import React from 'react'; import useSubscribersOverview from 'calypso/my-sites/stats/hooks/use-subscribers-overview'; @@ -8,16 +9,25 @@ interface SubscribersOverviewProps { const SubscribersOverview: React.FC< SubscribersOverviewProps > = ( { siteId } ) => { const { isLoading, isError, overviewData } = useSubscribersOverview( siteId ); + const translate = useTranslate(); return (
{ overviewData.map( ( { count, heading }, index ) => { + let note = translate( 'As of today' ); + if ( heading !== 'Today' ) { + const prefix = translate( 'Since' ); + note = `${ prefix } ${ heading }`; + } + return ( // TODO: Communicate loading vs error state to the user. diff --git a/packages/components/src/highlight-cards/annual-highlight-cards.tsx b/packages/components/src/highlight-cards/annual-highlight-cards.tsx index 595d22149a463..1cc9957b282fd 100644 --- a/packages/components/src/highlight-cards/annual-highlight-cards.tsx +++ b/packages/components/src/highlight-cards/annual-highlight-cards.tsx @@ -48,6 +48,7 @@ function AnnualHighlightsStandard( { counts }: AnnualHighlightsProps ) { } showValueTooltip diff --git a/packages/components/src/highlight-cards/count-card.tsx b/packages/components/src/highlight-cards/count-card.tsx index eea7423717d28..61ebb28fe0e06 100644 --- a/packages/components/src/highlight-cards/count-card.tsx +++ b/packages/components/src/highlight-cards/count-card.tsx @@ -7,17 +7,20 @@ import { formatNumber } from './lib/numbers'; interface CountCardProps { heading?: React.ReactNode; icon?: JSX.Element; + label?: string; note?: string; showValueTooltip?: boolean; value: number | string | null; } -function TooltipContent( { value }: CountCardProps ) { +function TooltipContent( { value, label, note }: CountCardProps ) { return (
{ formatNumber( value as number, false ) } + { label && ` ${ label }` } + { note &&
{ note }
}
); } @@ -25,6 +28,7 @@ function TooltipContent( { value }: CountCardProps ) { export default function CountCard( { heading, icon, + label, note, value, showValueTooltip, @@ -58,8 +62,7 @@ export default function CountCard( { position="bottom right" context={ textRef.current } > - - { note &&
{ note }
} + ) } diff --git a/packages/components/src/highlight-cards/style.scss b/packages/components/src/highlight-cards/style.scss index be23e7741942d..da51f42497c82 100644 --- a/packages/components/src/highlight-cards/style.scss +++ b/packages/components/src/highlight-cards/style.scss @@ -342,7 +342,7 @@ $highlight-card-tooltip-font: Inter, $sans !default; } .highlight-card-tooltip-content { - display: flex; + display: block; align-items: center; justify-content: space-between; font-size: $font-body-small; @@ -397,8 +397,8 @@ $highlight-card-tooltip-font: Inter, $sans !default; } .highlight-card-tooltip-note { - font-size: $font-body-extra-small; - padding-top: 8px; + color: var(--studio-gray-30); + font-size: $font-body-small; } .highlight-card__settings-tooltip { .highlight-card-tooltip-content {