Skip to content
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

Site management panel - Keep "WP Admin" and "Home" button primary across all tabs #94774

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ interface Props {
selectedSiteFeaturePreview: React.ReactNode;
closeSitePreviewPane: () => void;
changeSitePreviewPane: ( siteId: number ) => void;
sectionName?: string;
}

const OVERLAY_MODAL_SELECTORS = [
Expand All @@ -43,12 +42,6 @@ const OVERLAY_MODAL_SELECTORS = [
'div.help-center__container:not(.is-minimized)',
];

type HeaderButtonsProps = {
focusRef: React.RefObject< HTMLButtonElement >;
itemData: ItemData;
closeSitePreviewPane: () => void;
};

const DotcomPreviewPane = ( {
site,
selectedSiteFeature,
Expand Down Expand Up @@ -200,9 +193,7 @@ const DotcomPreviewPane = ( {
itemPreviewPaneHeaderExtraProps={ {
externalIconSize: 16,
siteIconFallback: 'first-grapheme',
headerButtons: ( props: HeaderButtonsProps ) => (
<PreviewPaneHeaderButtons { ...props } sectionName={ selectedSiteFeature } />
),
headerButtons: PreviewPaneHeaderButtons,
subtitleExtra: () =>
( site.is_wpcom_staging_site || isStagingStatusFinished ) && (
<SiteEnvironmentSwitcher onChange={ changeSitePreviewPane } site={ site } />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,20 @@ type Props = {
focusRef: React.RefObject< HTMLButtonElement >;
itemData: ItemData;
closeSitePreviewPane?: () => void;
sectionName?: string;
};

const PreviewPaneHeaderButtons = ( {
focusRef,
closeSitePreviewPane,
itemData,
sectionName,
}: Props ) => {
const PreviewPaneHeaderButtons = ( { focusRef, closeSitePreviewPane, itemData }: Props ) => {
const adminButtonRef = useRef< HTMLButtonElement | null >( null );
const { adminLabel, adminUrl } = useSiteAdminInterfaceData( itemData.blogId );
const { __ } = useI18n();
const isHostingOverview = sectionName === 'dotcom-hosting';

return (
<>
<Button onClick={ closeSitePreviewPane } className="item-preview__close-preview-button">
{ __( 'Close' ) }
</Button>
<Button
primary={ isHostingOverview }
primary
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what makes the button blue (the CTA). Everything else in this PR is reverting the supporting code added in #94192

className="item-preview__admin-button"
href={ `${ adminUrl }` }
ref={ useMergeRefs( [ adminButtonRef, focusRef ] ) }
Expand Down
2 changes: 0 additions & 2 deletions client/hosting/sites/components/sites-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ const SitesDashboard = ( {
selectedSite,
initialSiteFeature = DOTCOM_OVERVIEW,
selectedSiteFeaturePreview = undefined,
sectionName,
}: SitesDashboardProps ) => {
const [ initialSortApplied, setInitialSortApplied ] = useState( false );
const isWide = useBreakpoint( WIDE_BREAKPOINT );
Expand Down Expand Up @@ -442,7 +441,6 @@ const SitesDashboard = ( {
setSelectedSiteFeature={ setSelectedSiteFeature }
closeSitePreviewPane={ closeSitePreviewPane }
changeSitePreviewPane={ changeSitePreviewPane }
sectionName={ sectionName }
/>
</LayoutColumn>
<GuidedTour defaultTourId="siteManagementTour" />
Expand Down
Loading