Add location-specific configuration

This commit is contained in:
Philipp Stracker 2025-01-17 13:20:58 +01:00
parent 4b47084aa2
commit 0428dd08aa
No known key found for this signature in database
3 changed files with 12 additions and 6 deletions

View file

@ -138,10 +138,11 @@ export const useLabelProps = ( location ) => {
export const useLayoutProps = ( location ) => {
const { getLocationProp, setLocationProp } = useHooks();
const { details } = useLocationProps( location );
return {
choices: Object.values( STYLING_LAYOUTS ),
isAvailable: true,
isAvailable: false !== details.props.layout,
layout: getLocationProp( location, 'layout' ),
setLayout: ( layout ) => setLocationProp( location, 'layout', layout ),
};
@ -149,6 +150,7 @@ export const useLayoutProps = ( location ) => {
export const useTaglineProps = ( location ) => {
const { getLocationProp, setLocationProp } = useHooks();
const { details } = useLocationProps( location );
return {
choices: [
@ -157,7 +159,10 @@ export const useTaglineProps = ( location ) => {
label: __( 'Enable Tagline', 'woocommerce-paypal-payments' ),
},
],
isAvailable: true,
isAvailable:
false !== details.props.tagline &&
STYLING_LAYOUTS.horizontal.value ===
getLocationProp( location, 'layout' ),
tagline: getLocationProp( location, 'tagline' ),
setTagline: ( tagline ) =>
setLocationProp( location, 'tagline', tagline ),