Change Visibility section label when a password is set (#44624)
* Change visibility section label * Add changelog * Fix changelog
This commit is contained in:
parent
d2e25b91b3
commit
cb967f6dfd
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: dev
|
||||
|
||||
[Product editor block]: Change visibility label when a password is set #44623
|
|
@ -31,17 +31,25 @@ export function VisibilitySection( { productType }: VisibilitySectionProps ) {
|
|||
'post_password'
|
||||
);
|
||||
|
||||
function getVisibilityLabel() {
|
||||
if ( postPassword !== '' ) {
|
||||
return __( 'Password protected', 'woocommerce' );
|
||||
}
|
||||
if ( catalogVisibility === 'visible' ) {
|
||||
return __( 'Public', 'woocommerce' );
|
||||
}
|
||||
return __( 'Hidden', 'woocommerce' );
|
||||
}
|
||||
|
||||
return (
|
||||
<PanelBody
|
||||
initialOpen={ false }
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore We need to send an Element.
|
||||
title={ [
|
||||
__( 'Visibility:', 'woocommerce' ),
|
||||
__( 'Visibility: ', 'woocommerce' ),
|
||||
<span className="editor-post-publish-panel__link" key="label">
|
||||
{ catalogVisibility === 'visible'
|
||||
? __( 'Public', 'woocommerce' )
|
||||
: __( 'Hidden', 'woocommerce' ) }
|
||||
{ getVisibilityLabel() }
|
||||
</span>,
|
||||
] }
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue