Skip to content

Commit

Permalink
Domains Management Revamp: Fix breadcrumb line break on smaller scree…
Browse files Browse the repository at this point in the history
…ns (#98431)

* Register plans comparison route

* Update page header

* Hide back button

* Update path generation

* Fix popover style

* Reduce table padding for smaller screens

* Accept classname for breadcrumb items

* Break line only for long domain names

* Add custom classname for domain items on breadcrumbs

* Add missing dependency on useMemo

* Fix lint
  • Loading branch information
phcp authored Jan 16, 2025
1 parent ed3c9fc commit 6ee6989
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 9 deletions.
3 changes: 2 additions & 1 deletion client/components/breadcrumb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export type Item = {
helpBubble?: React.ReactElement;
icon?: React.ReactElement;
onClick?: () => void;
className?: string;
};
interface Props {
items: Item[];
Expand Down Expand Up @@ -140,7 +141,7 @@ const Breadcrumb: React.FunctionComponent< Props > = ( props ) => {
return (
<StyledUl className="breadcrumbs">
{ items.map( ( item: Item, index: Key ) => (
<StyledLi key={ index }>
<StyledLi key={ index } className={ item.className }>
{ item.icon && <StyledIcon>{ item.icon }</StyledIcon> }
{ index !== 0 && <StyledGridicon icon="chevron-right" size={ 14 } /> }
{ item.href && index !== items.length - 1 ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const AddForwardingEmailHeader: CustomHeaderComponentType = ( {
currentRoute,
inSiteContext
),
className: 'navigation-header__domain-name',
},
{
label: translate( 'Email' ),
Expand Down Expand Up @@ -57,7 +58,7 @@ const AddForwardingEmailHeader: CustomHeaderComponentType = ( {
}

return baseNavigationItems;
}, [ inSiteContext, selectedDomainName, selectedSiteSlug, site, translate ] );
}, [ currentRoute, inSiteContext, selectedDomainName, selectedSiteSlug, site, translate ] );

return (
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const AddMailboxHeader: CustomHeaderComponentType = ( {
{
label: selectedDomainName,
href: `${ domainManagementOverviewRoot() }/${ selectedDomainName }/${ selectedSiteSlug }`,
className: 'navigation-header__domain-name',
},
{
label: translate( 'Email' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const CompareEmailProvidersHeader: CustomHeaderComponentType = ( {
currentRoute,
inSiteContext
),
className: 'navigation-header__domain-name',
},
{
label: translate( 'Email' ),
Expand Down Expand Up @@ -56,7 +57,7 @@ const CompareEmailProvidersHeader: CustomHeaderComponentType = ( {
}

return baseNavigationItems;
}, [ inSiteContext, selectedDomainName, selectedSiteSlug, site ] );
}, [ currentRoute, inSiteContext, selectedDomainName, selectedSiteSlug, site ] );

return (
<NavigationHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ContactInformationHeader: CustomHeaderComponentType = ( {
null,
inSiteContext
),
className: 'navigation-header__domain-name',
},
{
label: translate( 'Contact information' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const DnsRecordHeader: CustomHeaderComponentType = ( {
null,
inSiteContext
),
className: 'navigation-header__domain-name',
},
{
label: translate( 'DNS records' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const DNSRecordsHeader: CustomHeaderComponentType = ( {
null,
inSiteContext
),
className: 'navigation-header__domain-name',
},
{
label: dnsRecordsTitle,
Expand All @@ -58,7 +59,7 @@ const DNSRecordsHeader: CustomHeaderComponentType = ( {
}

return baseNavigationItems;
}, [ inSiteContext, selectedDomainName, selectedSiteSlug, site, translate ] );
}, [ inSiteContext, selectedDomainName, selectedSiteSlug, site ] );

return (
<NavigationHeader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,17 @@
padding-top: 16px;

.breadcrumbs li {
> a,
> span {
word-break: break-word;
overflow-wrap: break-word;
white-space: normal;
&.navigation-header__domain-name {
> a,
> span {
word-break: break-word;
overflow-wrap: break-word;
white-space: normal;
}
}

> .gridicons-chevron-right {
margin: 0 8px;
}
}
}
Expand Down

0 comments on commit 6ee6989

Please sign in to comment.