Skip to content

Commit e6a5063

Browse files
Sentence case area slug for details
1 parent 0a145e7 commit e6a5063

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

packages/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* External dependencies
3+
*/
4+
import { sentenceCase } from 'change-case';
5+
16
/**
27
* WordPress dependencies
38
*/
@@ -82,10 +87,19 @@ export default function usePatternDetails( postType, postId ) {
8287
( area ) => area.area === record.area
8388
);
8489

85-
details.push( {
86-
label: __( 'Area' ),
87-
value: templatePartArea?.label || record.area || __( 'None' ),
88-
} );
90+
let areaDetailValue = templatePartArea?.label;
91+
92+
if ( ! areaDetailValue ) {
93+
areaDetailValue = record.area
94+
? sprintf(
95+
// translators: %s: Sentenced cased template part area e.g: "My custom area".
96+
__( '%s (removed)' ),
97+
sentenceCase( record.area )
98+
)
99+
: __( 'None' );
100+
}
101+
102+
details.push( { label: __( 'Area' ), value: areaDetailValue } );
89103
}
90104

91105
if (

0 commit comments

Comments
 (0)