-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show breadcrumbs in individual theme header #94038
Changes from all commits
fa34d91
10619ee
d6b1003
fb981f2
b63f448
d2fbda6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ const StyledGridicon = styled( Gridicon )` | |
color: var( --color-neutral-10 ); | ||
`; | ||
|
||
const HelpBuble = styled( InfoPopover )` | ||
const HelpBubble = styled( InfoPopover )` | ||
margin-left: 7px; | ||
display: flex; | ||
align-items: center; | ||
|
@@ -79,13 +79,18 @@ const renderHelpBubble = ( item: Item ) => { | |
} | ||
|
||
return ( | ||
<HelpBuble icon="help-outline" position="right"> | ||
<HelpBubble icon="help-outline" position="right"> | ||
{ item.helpBubble } | ||
</HelpBuble> | ||
</HelpBubble> | ||
); | ||
}; | ||
|
||
export type Item = { label: string; href?: string; helpBubble?: React.ReactElement }; | ||
export type Item = { | ||
label: string; | ||
href?: string; | ||
helpBubble?: React.ReactElement; | ||
onClick?: () => void; | ||
}; | ||
interface Props { | ||
items: Item[]; | ||
mobileItem?: Item; | ||
|
@@ -127,11 +132,13 @@ const Breadcrumb: React.FunctionComponent< Props > = ( props ) => { | |
|
||
return ( | ||
<StyledUl className="breadcrumbs"> | ||
{ items.map( ( item: { href?: string; label: string }, index: Key ) => ( | ||
{ items.map( ( item: Item, index: Key ) => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing the type here with the type already defined above. |
||
<StyledLi key={ index }> | ||
{ index !== 0 && <StyledGridicon icon="chevron-right" size={ 14 } /> } | ||
{ item.href && index !== items.length - 1 ? ( | ||
<a href={ item.href }>{ item.label }</a> | ||
<a href={ item.href } onClick={ item.onClick }> | ||
{ item.label } | ||
</a> | ||
) : ( | ||
<span>{ item.label }</span> | ||
) } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,9 @@ import QuerySitePlans from 'calypso/components/data/query-site-plans'; | |
import QuerySitePurchases from 'calypso/components/data/query-site-purchases'; | ||
import QueryUserPurchases from 'calypso/components/data/query-user-purchases'; | ||
import SyncActiveTheme from 'calypso/components/data/sync-active-theme'; | ||
import HeaderCake from 'calypso/components/header-cake'; | ||
import InlineSupportLink from 'calypso/components/inline-support-link'; | ||
import Main from 'calypso/components/main'; | ||
import NavigationHeader from 'calypso/components/navigation-header'; | ||
import PremiumGlobalStylesUpgradeModal from 'calypso/components/premium-global-styles-upgrade-modal'; | ||
import ThemeSiteSelectorModal from 'calypso/components/theme-site-selector-modal'; | ||
import { THEME_TIERS } from 'calypso/components/theme-tier/constants'; | ||
|
@@ -1215,18 +1215,14 @@ class ThemeSheet extends Component { | |
return styleVariations.find( ( variation ) => variation.slug === selectedStyleVariationSlug ); | ||
}; | ||
|
||
goBack = () => { | ||
const { backPath, locale, isLoggedIn, themeId } = this.props; | ||
this.props.recordTracksEvent( 'calypso_theme_sheet_back_click', { theme_name: themeId } ); | ||
|
||
// Use history back when coming from customize your store screen. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Asked about removing this here: p1725572262533179-slack-C01SFMVEYAK There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed: p1725630569410769/1725572262.533179-slack-C01SFMVEYAK |
||
const urlParams = new URLSearchParams( window.location.search ); | ||
if ( urlParams.has( 'from', 'customize-store' ) && window.history.length > 1 ) { | ||
window.history.back(); | ||
return; | ||
} | ||
getBackLink = () => { | ||
const { backPath, locale, isLoggedIn } = this.props; | ||
return localizeThemesPath( backPath, locale, ! isLoggedIn ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm returning a path for the breadcrumb instead of redirecting the page. |
||
}; | ||
|
||
page( localizeThemesPath( backPath, locale, ! isLoggedIn ) ); | ||
handleBackLinkClick = () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this function for the Tracks event. |
||
const { themeId } = this.props; | ||
this.props.recordTracksEvent( 'calypso_theme_sheet_back_click', { theme_name: themeId } ); | ||
}; | ||
|
||
getBannerUpsellTitle = () => <BannerUpsellTitle { ...this.props } />; | ||
|
@@ -1377,6 +1373,11 @@ class ThemeSheet extends Component { | |
'is-removed': isRemoved, | ||
} ); | ||
|
||
const navigationItems = [ | ||
{ label: translate( 'Themes' ), href: this.getBackLink(), onClick: this.handleBackLinkClick }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if "Back to themes" was better language for screen readers. But this matches "Plugins." |
||
{ label: title }, | ||
]; | ||
|
||
return ( | ||
<Main className="theme__sheet"> | ||
<QueryCanonicalTheme themeId={ this.props.themeId } siteId={ siteId } /> | ||
|
@@ -1426,14 +1427,7 @@ class ThemeSheet extends Component { | |
/> | ||
<ThanksModal source="details" themeId={ this.props.themeId } /> | ||
<ActivationModal source="details" /> | ||
<div className="theme__sheet-action-bar-container"> | ||
<HeaderCake | ||
className="theme__sheet-action-bar" | ||
backText={ translate( 'Back to themes' ) } | ||
onClick={ this.goBack } | ||
alwaysShowBackText | ||
/> | ||
</div> | ||
<NavigationHeader navigationItems={ navigationItems } /> | ||
<div className={ columnsClassName }> | ||
<div className="theme__sheet-column-header"> | ||
{ this.renderStagingPaidThemeNotice() } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing a typo.