-
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.
- Loading branch information
Showing
8 changed files
with
91 additions
and
9 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
56 changes: 56 additions & 0 deletions
56
...my-sites/domains/domain-management/subpage-wrapper/headers/contact-information-header.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,56 @@ | ||
import { useTranslate } from 'i18n-calypso'; | ||
import { useMemo } from 'react'; | ||
import NavigationHeader from 'calypso/components/navigation-header'; | ||
import { domainManagementOverviewRoot } from 'calypso/my-sites/domains/paths'; | ||
import { useSelector } from 'calypso/state'; | ||
import { getSite } from 'calypso/state/sites/selectors'; | ||
import { CustomHeaderComponentType } from './custom-header-component-type'; | ||
|
||
const ContactInformationHeader: CustomHeaderComponentType = ( { | ||
selectedDomainName, | ||
selectedSiteSlug, | ||
inSiteContext, | ||
} ) => { | ||
const translate = useTranslate(); | ||
const site = useSelector( ( state ) => getSite( state, selectedSiteSlug ) ); | ||
|
||
const navigationItems = useMemo( () => { | ||
const baseNavigationItems = [ | ||
{ | ||
label: selectedDomainName, | ||
href: `${ domainManagementOverviewRoot() }/${ selectedDomainName }/${ selectedSiteSlug }`, | ||
}, | ||
{ | ||
label: translate( 'Contact information' ), | ||
}, | ||
]; | ||
|
||
if ( inSiteContext ) { | ||
return [ | ||
{ | ||
label: site?.name || selectedDomainName, | ||
href: `/overview/${ selectedSiteSlug }`, | ||
}, | ||
...baseNavigationItems, | ||
]; | ||
} | ||
|
||
return baseNavigationItems; | ||
}, [ inSiteContext, selectedDomainName, selectedSiteSlug, site, translate ] ); | ||
|
||
return ( | ||
<> | ||
<NavigationHeader | ||
className="navigation-header__breadcrumb" | ||
navigationItems={ navigationItems } | ||
/> | ||
<NavigationHeader | ||
className="navigation-header__title" | ||
title={ translate( 'Contact information' ) } | ||
subtitle={ translate( "Manage your domain's contact details." ) } | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default ContactInformationHeader; |
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
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
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