Skip to content

Commit

Permalink
Sentence case area slug for details
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Jul 27, 2023
1 parent 0a145e7 commit e6a5063
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* External dependencies
*/
import { sentenceCase } from 'change-case';

/**
* WordPress dependencies
*/
Expand Down Expand Up @@ -82,10 +87,19 @@ export default function usePatternDetails( postType, postId ) {
( area ) => area.area === record.area
);

details.push( {
label: __( 'Area' ),
value: templatePartArea?.label || record.area || __( 'None' ),
} );
let areaDetailValue = templatePartArea?.label;

if ( ! areaDetailValue ) {
areaDetailValue = record.area
? sprintf(
// translators: %s: Sentenced cased template part area e.g: "My custom area".
__( '%s (removed)' ),
sentenceCase( record.area )
)
: __( 'None' );
}

details.push( { label: __( 'Area' ), value: areaDetailValue } );
}

if (
Expand Down

0 comments on commit e6a5063

Please sign in to comment.