forked from Automattic/wp-calypso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Domains: Add empty state to All Domains page (Automattic#78841)
* Extract empty state component * Render empty state if no domains at all * Scope empty state to All Domains * Remove icon from CTA * Rewrite CTA targets
- Loading branch information
Showing
3 changed files
with
148 additions
and
82 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
85 changes: 85 additions & 0 deletions
85
client/my-sites/domains/domain-management/list/empty-domains-list-card-skeleton.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,85 @@ | ||
import { Card, Button } from '@automattic/components'; | ||
import classNames from 'classnames'; | ||
import customerHomeIllustrationTaskFindDomain from 'calypso/assets/images/domains/free-domain.svg'; | ||
import TrackComponentView from 'calypso/lib/analytics/track-component-view'; | ||
import { useDispatch } from 'calypso/state'; | ||
import { recordTracksEvent } from 'calypso/state/analytics/actions'; | ||
|
||
interface EmptyDomainsListCardSkeletonProps { | ||
className?: string; | ||
isCompact?: boolean; | ||
title?: string; | ||
line?: string; | ||
actionURL: string; | ||
contentType: string; | ||
action: string; | ||
secondaryActionURL: string; | ||
secondaryAction: string; | ||
} | ||
|
||
export const EmptyDomainsListCardSkeleton = ( { | ||
className, | ||
isCompact, | ||
title, | ||
line, | ||
actionURL, | ||
contentType, | ||
action, | ||
secondaryActionURL, | ||
secondaryAction, | ||
}: EmptyDomainsListCardSkeletonProps ) => { | ||
const dispatch = useDispatch(); | ||
|
||
const getActionClickHandler = | ||
( type: string, buttonURL: string, sourceCardType: string ) => () => { | ||
dispatch( | ||
recordTracksEvent( 'calypso_empty_domain_list_card_action', { | ||
button_type: type, | ||
button_url: buttonURL, | ||
source_card_type: sourceCardType, | ||
} ) | ||
); | ||
}; | ||
|
||
const illustration = customerHomeIllustrationTaskFindDomain && ( | ||
<img src={ customerHomeIllustrationTaskFindDomain } alt="" width={ 150 } /> | ||
); | ||
|
||
return ( | ||
<Card className={ classNames( 'empty-domains-list-card', className ) }> | ||
<div | ||
className={ classNames( 'empty-domains-list-card__wrapper', { | ||
'is-compact': isCompact, | ||
'has-title-only': title && ! line, | ||
} ) } | ||
> | ||
<div className="empty-domains-list-card__illustration">{ illustration }</div> | ||
<div className="empty-domains-list-card__content"> | ||
<div className="empty-domains-list-card__text"> | ||
{ title ? <h2>{ title }</h2> : null } | ||
{ line ? <h3>{ line }</h3> : null } | ||
</div> | ||
<div className="empty-domains-list-card__actions"> | ||
<Button | ||
primary | ||
onClick={ getActionClickHandler( 'primary', actionURL, contentType ) } | ||
href={ actionURL } | ||
> | ||
{ action } | ||
</Button> | ||
<Button | ||
onClick={ getActionClickHandler( 'secondary', secondaryActionURL, contentType ) } | ||
href={ secondaryActionURL } | ||
> | ||
{ secondaryAction } | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
<TrackComponentView | ||
eventName="calypso_get_your_domain_empty_impression" | ||
eventProperties={ { content_type: contentType } } | ||
/> | ||
</Card> | ||
); | ||
}; |
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