-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stats: Add UTM module overlay with blurred fake data bars (#88629)
* Remove unused prop of StatsCardUpsellJetpack * Introduce StatsCard with fake data and an overlay as StatsModuleUTMOverlay * Add blur to splitHeader of StatsCard * Pass className to StatsModuleUTMOverlay for layout grid
- Loading branch information
1 parent
5841579
commit eaa2b90
Showing
4 changed files
with
79 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
client/my-sites/stats/stats-module-utm/stats-module-utm-overlay.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.stats-module-utm-overlay { | ||
.stats-card--column-header { | ||
filter: blur(10px); | ||
} | ||
|
||
.stats-card__content { | ||
// Prevent blur elements from being interactable. | ||
pointer-events: none; | ||
user-select: none; | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
client/my-sites/stats/stats-module-utm/stats-module-utm-overlay.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import classNames from 'classnames'; | ||
import React from 'react'; | ||
import { useSelector } from 'calypso/state'; | ||
import { getSiteSlug } from 'calypso/state/sites/selectors'; | ||
import StatsCardUpsellJetpack from '../stats-card-upsell/stats-card-upsell-jetpack'; | ||
import StatsListCard from '../stats-list/stats-list-card'; | ||
|
||
import './stats-module-utm-overlay.scss'; | ||
|
||
type StatsModuleUTMOverlayProps = { | ||
siteId: number; | ||
className?: string; | ||
}; | ||
|
||
const StatsModuleUTMOverlay: React.FC< StatsModuleUTMOverlayProps > = ( { siteId, className } ) => { | ||
const siteSlug = useSelector( ( state ) => getSiteSlug( state, siteId ) || '' ); | ||
|
||
const fakeData = [ | ||
{ | ||
label: 'google / cpc', | ||
value: 102, | ||
}, | ||
{ | ||
label: 'linkedin / social', | ||
value: 15, | ||
}, | ||
{ | ||
label: 'google / organic', | ||
value: 14, | ||
}, | ||
{ | ||
label: 'facebook.com / social', | ||
value: 13, | ||
}, | ||
{ | ||
label: 'newsletter / email', | ||
value: 12, | ||
}, | ||
{ | ||
label: 'x.com / social', | ||
value: 12, | ||
}, | ||
{ | ||
label: 'rss / rss', | ||
value: 10, | ||
}, | ||
]; | ||
|
||
return ( | ||
// @ts-expect-error TODO: Refactor StatsListCard with TypeScript. | ||
<StatsListCard | ||
title="UTM" | ||
className={ classNames( className, 'stats-module-utm-overlay', 'stats-module__card', 'utm' ) } | ||
moduleType="utm" | ||
data={ fakeData } | ||
mainItemLabel="Posts by Source / Medium" | ||
splitHeader | ||
showMore={ { | ||
label: 'View all', | ||
} } | ||
overlay={ <StatsCardUpsellJetpack className="stats-module__upsell" siteSlug={ siteSlug } /> } | ||
></StatsListCard> | ||
); | ||
}; | ||
|
||
export default StatsModuleUTMOverlay; |