Skip to content
Open
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
5 changes: 4 additions & 1 deletion client/dashboard/components/section-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const SectionHeader = ( {
prefix,
className,
level = 2,
hasActionDropdown = false,
}: SectionHeaderProps ) => {
const HeadingTag = `h${ level }` as keyof JSX.IntrinsicElements;
return (
Expand Down Expand Up @@ -53,7 +54,9 @@ export const SectionHeader = ( {
justify="flex-start"
expanded={ false }
alignment="flex-start"
className="dashboard-section-header__actions"
className={ clsx( 'dashboard-section-header__actions', {
'has-action-dropdown': !! hasActionDropdown,
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels weird to introduce this to SectionHeader. It seems the actions should handle it itself

} ) }
style={ { flex: '1 1 auto' } }
>
{ actions }
Expand Down
7 changes: 7 additions & 0 deletions client/dashboard/components/section-header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@
flex-shrink: 0;
align-self: stretch;
}

.dashboard-section-header__actions.has-action-dropdown {
:last-child {
margin-inline-start: auto;
min-width: fit-content;
}
}
4 changes: 4 additions & 0 deletions client/dashboard/components/section-header/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export interface SectionHeaderProps {
* or a search input, relevant to the page or section.
*/
actions?: React.ReactNode;
/**
* Whether the section header has a dropdown in the actions section.
*/
hasActionDropdown?: boolean;
/**
* An optional visual element like an icon or small illustration
* to enhance recognition or provide visual interest.
Expand Down
6 changes: 5 additions & 1 deletion client/dashboard/domains/dns/add.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export default function DomainAddDNS() {
<PageLayout
size="small"
header={
<PageHeader prefix={ <Breadcrumbs length={ 3 } /> } description={ <DnsDescription /> } />
<PageHeader
prefix={ <Breadcrumbs length={ 3 } /> }
description={ <DnsDescription /> }
hasActionDropdown
/>
}
>
<DNSRecordForm
Expand Down
6 changes: 5 additions & 1 deletion client/dashboard/domains/dns/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ export default function DomainEditDNS() {
<PageLayout
size="small"
header={
<PageHeader prefix={ <Breadcrumbs length={ 3 } /> } description={ <DnsDescription /> } />
<PageHeader
prefix={ <Breadcrumbs length={ 3 } /> }
description={ <DnsDescription /> }
hasActionDropdown
/>
}
>
<DNSRecordForm
Expand Down
1 change: 1 addition & 0 deletions client/dashboard/domains/domain-dns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ export default function DomainDns() {
</HStack>
}
description={ <DnsDescription /> }
hasActionDropdown
/>
</VStack>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { Link } from '@tanstack/react-router';
import {
__experimentalGrid as Grid,
__experimentalText as Text,
__experimentalHStack as HStack,
__experimentalVStack as VStack,
DropdownMenu,
MenuGroup,
Expand Down Expand Up @@ -1084,16 +1083,17 @@ export default function PurchaseSettings() {
title={ getTitleForDisplay( purchase ) }
actions={
site?.options?.admin_url && (
<HStack justify="space-between">
<>
{ canPurchaseBeUpgraded( purchase ) && upgradeUrl && (
<Button __next40pxDefaultSize variant="primary" href={ upgradeUrl }>
{ __( 'Upgrade' ) }
</Button>
) }
<PurchaseActionMenu purchase={ purchase } />
</HStack>
</>
)
}
hasActionDropdown
description={
<MetadataList>
<PurchaseSubtitle purchase={ purchase } />
Expand Down
27 changes: 13 additions & 14 deletions client/dashboard/sites/overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,19 @@ function SiteOverview( {
}

return (
<HStack justify="space-between">
<HStack justify={ isSmallViewport ? 'flex-start' : 'flex-end' } style={ { width: 'auto' } }>
<StagingSiteSyncDropdown siteSlug={ siteSlug } />
<Button
ref={ wpAdminButtonRef }
__next40pxDefaultSize
variant="primary"
href={ site.options.admin_url }
icon={ wordpress }
>
{ __( 'WP Admin' ) }
</Button>
</HStack>
<>
<StagingSiteSyncDropdown siteSlug={ siteSlug } />
<Button
ref={ wpAdminButtonRef }
__next40pxDefaultSize
variant="primary"
href={ site.options.admin_url }
icon={ wordpress }
>
{ __( 'WP Admin' ) }
</Button>
<SiteActionMenu site={ site } />
</HStack>
</>
);
};

Expand All @@ -223,6 +221,7 @@ function SiteOverview( {
title={ getSiteDisplayName( site ) }
description={ <SiteOverviewFields site={ site } /> }
actions={ renderActions() }
hasActionDropdown
/>
}
>
Expand Down