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

Update: Add descriptions to all panels in the Site Editor's dark side #48739

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 @@ -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