-
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.
Implement agency tier widget on Overview page
- Loading branch information
Showing
4 changed files
with
177 additions
and
1 deletion.
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
72 changes: 72 additions & 0 deletions
72
client/a8c-for-agencies/sections/overview/sidebar/agency-tier/index.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,72 @@ | ||
import { Card, FoldableCard } from '@automattic/components'; | ||
import { Button } from '@wordpress/components'; | ||
import { Icon, arrowRight } from '@wordpress/icons'; | ||
import { clsx } from 'clsx'; | ||
import { useTranslate } from 'i18n-calypso'; | ||
import { A4A_AGENCY_TIER_LINK } from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants'; | ||
import getAgencyTierInfo from 'calypso/a8c-for-agencies/sections/agency-tier/lib/get-agency-tier-info'; | ||
import { useSelector } from 'calypso/state'; | ||
import { getActiveAgency } from 'calypso/state/a8c-for-agencies/agency/selectors'; | ||
|
||
import './style.scss'; | ||
|
||
export default function OverviewSidebarAgencyTier() { | ||
const translate = useTranslate(); | ||
|
||
const agency = useSelector( getActiveAgency ); | ||
|
||
const currentAgencyTierInfo = agency?.tier?.id | ||
? getAgencyTierInfo( agency.tier.id, translate ) | ||
: null; | ||
|
||
const defaultAgencyTierInfo = getAgencyTierInfo( 'emerging-partner', translate ); | ||
|
||
return ( | ||
<Card className="agency-tier__card"> | ||
<FoldableCard | ||
className="foldable-nav" | ||
header={ translate( 'Your Agency Tier' ) } | ||
expanded | ||
compact | ||
iconSize={ 18 } | ||
> | ||
<div className="agency-tier__bottom-content"> | ||
<div | ||
className={ clsx( 'agency-tier__current-agency-tier-header', { | ||
'is-default': ! currentAgencyTierInfo, | ||
} ) } | ||
> | ||
{ currentAgencyTierInfo ? ( | ||
<> | ||
<span className="agency-tier__current-agency-tier-icon"> | ||
<img src={ currentAgencyTierInfo.logo } alt={ currentAgencyTierInfo.id } /> | ||
</span> | ||
<span className="agency-tier__current-agency-tier-title"> | ||
{ currentAgencyTierInfo.title } | ||
</span> | ||
</> | ||
) : ( | ||
<> | ||
<span className="agency-tier__current-agency-tier-icon"> | ||
<img src={ defaultAgencyTierInfo.logo } alt={ defaultAgencyTierInfo.id } /> | ||
</span> | ||
<span className="agency-tier__current-agency-tier-title"> | ||
{ defaultAgencyTierInfo.emptyStateMessage } | ||
</span> | ||
</> | ||
) } | ||
</div> | ||
{ currentAgencyTierInfo && ( | ||
<div className="agency-tier__current-agency-tier-description"> | ||
{ currentAgencyTierInfo.description } | ||
</div> | ||
) } | ||
<Button href={ A4A_AGENCY_TIER_LINK }> | ||
<Icon icon={ arrowRight } size={ 18 } /> | ||
{ translate( 'Explore tiers and benefits' ) } | ||
</Button> | ||
</div> | ||
</FoldableCard> | ||
</Card> | ||
); | ||
} |
74 changes: 74 additions & 0 deletions
74
client/a8c-for-agencies/sections/overview/sidebar/agency-tier/style.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,74 @@ | ||
.agency-tier__card { | ||
padding: 8px; | ||
border-radius: 4px; | ||
|
||
.foldable-card__header { | ||
padding-inline: 12px; | ||
} | ||
|
||
.sidebar-v2__menu-item { | ||
&:hover { | ||
svg.sidebar-v2__external-icon { | ||
color: var(--color-text-inverted); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.agency-tier__bottom-content { | ||
padding-inline: 12px; | ||
|
||
.agency-tier__current-agency-tier-header { | ||
margin-inline-start: 8px; | ||
padding-block: 16px 12px; | ||
display: flex; | ||
gap: 16px; | ||
|
||
.agency-tier__current-agency-tier-icon img { | ||
transform: scale(1.5); | ||
} | ||
|
||
.agency-tier__current-agency-tier-title { | ||
@include a4a-font-heading-lg; | ||
} | ||
|
||
&.is-default { | ||
margin-inline-start: 14px; | ||
padding-block: 36px; | ||
gap: 24px; | ||
|
||
.agency-tier__current-agency-tier-icon { | ||
display: flex; | ||
width: 80px; | ||
|
||
img { | ||
transform: scale(1.6); | ||
} | ||
} | ||
|
||
.agency-tier__current-agency-tier-title { | ||
@include a4a-font-body-lg; | ||
} | ||
} | ||
} | ||
|
||
.agency-tier__current-agency-tier-description { | ||
@include a4a-font-body-md; | ||
padding-block-end: 8px; | ||
} | ||
} | ||
|
||
.foldable-nav.foldable-card.card .foldable-card__content .agency-tier__bottom-content a.components-button { | ||
@include a4a-font-body-md; | ||
padding: 0; | ||
color: var(--color-gray-40); | ||
|
||
svg { | ||
margin-inline-end: 8px; | ||
} | ||
|
||
&:hover { | ||
background: none; | ||
box-shadow: none; | ||
} | ||
} |
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