{ tabs.map( ( tab, index ) => {
const targetClientId =
getBlockOrder( clientId )[ index ];
const onClickTab = () => {
setCurrentTabPanelId( tab.tabPanelId );
};
const onChangeTitle = ( value ) => {
tabs[ index ].title = value;
setAttributes( { tabs: JSON.stringify( tabs ) } );
};
const onClickRemoveTabButton = () => {
removeBlocks(
!! targetClientId ? [ targetClientId ] : [],
false
);
tabs.splice( index, 1 );
setAttributes( { tabs: JSON.stringify( tabs ) } );
setCurrentTabPanelId( tabs[ 0 ].tabPanelId );
};
const onClickUpTabButton = () => {
moveBlocksUp(
!! targetClientId ? [ targetClientId ] : [],
clientId
);
const targetTab = tabs[ index ];
tabs.splice( index, 1 );
tabs.splice( index - 1, 0, targetTab );
setAttributes( { tabs: JSON.stringify( tabs ) } );
setCurrentTabPanelId(
tabs[ index - 1 ].tabPanelId
);
};
const onClickDownTabButton = () => {
moveBlocksDown(
!! targetClientId ? [ targetClientId ] : [],
clientId
);
const targetTab = tabs[ index ];
tabs.splice( index, 1 );
tabs.splice( index + 1, 0, targetTab );
setAttributes( { tabs: JSON.stringify( tabs ) } );
setCurrentTabPanelId(
tabs[ index + 1 ].tabPanelId
);
};
return (
{ 0 < index && (
) }
{ 1 < tabs.length && (
) }
{ tabs.length - 1 > index && (
) }
);
} ) }
{ !! currentTabPanelId && ! dataMatchHeightBoolean && (
) }
{ !! currentTabPanelId && dataMatchHeightBoolean && (
) }