Skip to content

Commit

Permalink
Refactor block-mover button and tooltip gutter value
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishit30G committed Aug 15, 2024
1 parent 10aaa2e commit c6be2d3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/block-mover/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const getDirection = ( direction, orientation ) => {
return isRTL() ? 'right' : 'left';
}
return 'up';
} else if ( direction === 'down' ) {
if ( orientation === 'horizontal' ) {
return isRTL() ? 'left' : 'right';
}
return 'down';
}
return null;
};
Expand Down
11 changes: 10 additions & 1 deletion packages/components/src/tooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ function UnforwardedTooltip(
showTimeout: delay,
} );

const getGutterValue = () => {
if ( direction === 'up' ) {
return 28;
} else if ( direction === 'down' ) {
return 8;
}
return 4;
};

const mounted = tooltipStore.useState( 'mounted' );

if ( isNestedInTooltip ) {
Expand Down Expand Up @@ -131,7 +140,7 @@ function UnforwardedTooltip(
{ ...restProps }
className={ clsx( 'components-tooltip', className ) }
unmountOnHide
gutter={ direction === 'up' ? 28 : 4 }
gutter={ getGutterValue() }
id={ describedById }
overflowPadding={ 0.5 }
store={ tooltipStore }
Expand Down

0 comments on commit c6be2d3

Please sign in to comment.