Skip to content

Commit

Permalink
Data views: Align page headers (#62115)
Browse files Browse the repository at this point in the history
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
3 people authored May 30, 2024
1 parent 5c5f3db commit 1568b81
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 26 deletions.
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/add-new-pattern/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ export default function AddNewPattern() {
<DropdownMenu
controls={ controls }
icon={ null }
toggleProps={ { variant: 'primary', showTooltip: false } }
toggleProps={ {
variant: 'primary',
showTooltip: false,
__next40pxDefaultSize: true,
} }
text={ addNewPatternLabel }
label={ addNewPatternLabel }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ function NewTemplate() {
variant="primary"
onClick={ () => setShowModal( true ) }
label={ postType.labels.add_new_item }
__next40pxDefaultSize
>
{ postType.labels.add_new_item }
</Button>
Expand Down
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,11 @@ export default function PagePages() {
actions={
addNewLabel && (
<>
<Button variant="primary" onClick={ openModal }>
<Button
variant="primary"
onClick={ openModal }
__next40pxDefaultSize
>
{ addNewLabel }
</Button>
{ showAddPageModal && (
Expand Down
16 changes: 12 additions & 4 deletions packages/edit-site/src/components/page-patterns/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,12 @@ export default function PatternsHeader( {
}

return (
<VStack className="edit-site-patterns__section-header" gap={ 3 }>
<HStack justify="space-between">
<Heading as="h2" level={ 4 } id={ titleId }>
<VStack className="edit-site-patterns__section-header" spacing={ 0 }>
<HStack
justify="space-between"
className="edit-site-patterns__title"
>
<Heading as="h2" level={ 3 } id={ titleId } weight={ 500 }>
{ title }
</Heading>
<HStack expanded={ false }>
Expand Down Expand Up @@ -96,7 +99,12 @@ export default function PatternsHeader( {
</HStack>
</HStack>
{ description ? (
<Text variant="muted" as="p" id={ descriptionId }>
<Text
variant="muted"
as="p"
id={ descriptionId }
className="edit-site-patterns__sub-title"
>
{ description }
</Text>
) : null }
Expand Down
12 changes: 10 additions & 2 deletions packages/edit-site/src/components/page-patterns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,22 @@

.edit-site-patterns__section-header {
border-bottom: 1px solid #f0f0f0;
min-height: 72px;
padding: $grid-unit-30 $grid-unit-60;
padding: $grid-unit-20 $grid-unit-60;
position: sticky;
top: 0;
z-index: 2;
flex-shrink: 0;
transition: padding ease-out 0.1s;
@include reduce-motion("transition");
min-height: $grid-unit-50;

.edit-site-patterns__title {
min-height: $grid-unit-50;
}

.edit-site-patterns__sub-title {
margin-bottom: $grid-unit-10;
}
}

.edit-site-patterns__pattern-title {
Expand Down
30 changes: 17 additions & 13 deletions packages/edit-site/src/components/page/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
__experimentalHeading as Heading,
__experimentalText as Text,
__experimentalHStack as HStack,
FlexBlock,
__experimentalVStack as VStack,
FlexItem,
} from '@wordpress/components';

Expand All @@ -15,8 +15,8 @@ import {

export default function Header( { title, subTitle, actions } ) {
return (
<HStack as="header" alignment="left" className="edit-site-page-header">
<FlexBlock className="edit-site-page-header__page-title">
<VStack className="edit-site-page-header" as="header" spacing={ 0 }>
<HStack className="edit-site-page-header__page-title">
<Heading
as="h2"
level={ 3 }
Expand All @@ -25,15 +25,19 @@ export default function Header( { title, subTitle, actions } ) {
>
{ title }
</Heading>
{ subTitle && (
<Text as="p" className="edit-site-page-header__sub-title">
{ subTitle }
</Text>
) }
</FlexBlock>
<FlexItem className="edit-site-page-header__actions">
{ actions }
</FlexItem>
</HStack>
<FlexItem className="edit-site-page-header__actions">
{ actions }
</FlexItem>
</HStack>
{ subTitle && (
<Text
variant="muted"
as="p"
className="edit-site-page-header__sub-title"
>
{ subTitle }
</Text>
) }
</VStack>
);
}
12 changes: 7 additions & 5 deletions packages/edit-site/src/components/page/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@
z-index: z-index(".edit-site-page-header");
transition: padding ease-out 0.1s;
@include reduce-motion("transition");
.components-text {
color: $gray-800;
}

.components-heading {
color: $gray-900;
}

.edit-site-page-header__page-title {
min-height: $grid-unit-50;
}

.edit-site-page-header__sub-title {
margin-top: $grid-unit-10;
color: $gray-700;
margin-bottom: $grid-unit-10;
}
}

Expand Down

1 comment on commit 1568b81

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 1568b81.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9301533888
📝 Reported issues:

Please sign in to comment.