Skip to content

Commit

Permalink
Update: Add descriptions to all panels in the Site Editor's dark side… (
Browse files Browse the repository at this point in the history
#48739)Co-authored-by: Matias Ventura <[email protected]>

* Update: Add descriptions to all panels in the Site Editor's dark sidebar.

* Update packages/edit-site/src/components/sidebar-navigation-screen-main/index.js

Co-authored-by: Matias Ventura <[email protected]>

---------

Co-authored-by: Matias Ventura <[email protected]>
  • Loading branch information
jorgefilipecosta and mtias authored Mar 6, 2023
1 parent 6af2dc0 commit e72bc18
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export default function SidebarNavigationScreenMain() {
<SidebarNavigationScreen
isRoot
title={ __( 'Design' ) }
description={ __(
'Customize the appearance of your website using the block editor.'
) }
content={
<ItemGroup>
{ !! navigationMenus && navigationMenus.length > 0 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ export default function SidebarNavigationScreenNavigationItem() {
icon={ pencil }
/>
}
description={
postType === 'page'
? __(
'Pages are static and are not listed by date. Pages do not use tags or categories.'
)
: __(
'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'
)
}
content={
<>
{ record?.link ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,10 @@ function SidebarNavigationScreenWrapper( { children, actions } ) {
<SidebarNavigationScreen
title={ __( 'Navigation' ) }
actions={ actions }
content={
<>
<p className="edit-site-sidebar-navigation-screen-navigation-menus__description">
{ __(
'Browse your site, edit pages, and manage your primary navigation menu.'
) }
</p>
{ children }
</>
}
description={ __(
'Browse your site, edit pages, and manage your primary navigation menu.'
) }
content={ children }
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.edit-site-sidebar-navigation-screen-navigation-menus__description {
.edit-site-sidebar-navigation-screen__description {
margin-top: 0;
margin-bottom: $grid-unit-40;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { useDispatch } from '@wordpress/data';
import { pencil } from '@wordpress/icons';
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
Expand All @@ -24,10 +24,18 @@ export default function SidebarNavigationScreenTemplate() {
postId
);
let description = getDescription();
if ( ! description && record.is_custom ) {
description = __(
'This is a custom template that can be applied manually to any Post or Page.'
);
if ( ! description ) {
if ( record.type === 'wp_template' && record.is_custom ) {
description = __(
'This is a custom template that can be applied manually to any Post or Page.'
);
} else if ( record.type === 'wp_template_part' ) {
description = sprintf(
// translators: %s: template part title e.g: "Header".
__( 'This is your %s template part.' ),
getTitle()
);
}
}

return (
Expand All @@ -40,7 +48,7 @@ export default function SidebarNavigationScreenTemplate() {
icon={ pencil }
/>
}
content={ description ? <p>{ description }</p> : undefined }
description={ description }
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
const config = {
wp_template: {
title: __( 'All templates' ),
description: __(
'Create new templates, or reset any customizations made to the templates supplied by your theme.'
),
},
wp_template_part: {
title: __( 'All template parts' ),
description: __(
'Create new template parts, or reset any customisations made to the template parts supplied by your theme." seems good.'
),
},
};

export default function SidebarNavigationScreenTemplatesBrowse() {
const {
params: { postType },
} = useNavigator();
return <SidebarNavigationScreen title={ config[ postType ].title } />;
return (
<SidebarNavigationScreen
title={ config[ postType ].title }
description={ config[ postType ].description }
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const config = {
loading: __( 'Loading templates' ),
notFound: __( 'No templates found' ),
manage: __( 'Manage all templates' ),
description: __(
'Express the layout of your site with templates.'
),
},
},
wp_template_part: {
Expand All @@ -37,6 +40,9 @@ const config = {
loading: __( 'Loading template parts' ),
notFound: __( 'No template parts found' ),
manage: __( 'Manage all template parts' ),
description: __(
'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'
),
},
},
};
Expand Down Expand Up @@ -80,6 +86,7 @@ export default function SidebarNavigationScreenTemplates() {
<SidebarNavigationScreen
isRoot={ isTemplatePartsMode }
title={ config[ postType ].labels.title }
description={ config[ postType ].labels.description }
actions={
canCreate && (
<AddNewTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function SidebarNavigationScreen( {
title,
actions,
content,
description,
} ) {
const { dashboardLink } = useSelect( ( select ) => {
const { getSettings } = unlock( select( editSiteStore ) );
Expand Down Expand Up @@ -58,6 +59,11 @@ export default function SidebarNavigationScreen( {
</HStack>

<nav className="edit-site-sidebar-navigation-screen__content">
{ description && (
<p className="edit-site-sidebar-navigation-screen__description">
{ description }
</p>
) }
{ content }
</nav>
</VStack>
Expand Down

1 comment on commit e72bc18

@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 e72bc18.
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/4343154347
📝 Reported issues:

Please sign in to comment.