Skip to content

Commit d516b23

Browse files
im3dabasiaim3dabasiaaferciaciampo
authored
Components: Remove unnecessary Tooltip component from linked button (#68498)
* fix: Removed extra tooltips component in button component * fix: label name * fix: Removed view component * doc: Update changelog for unreleased section * Add heading before new changelog entry --------- Co-authored-by: im3dabasia <[email protected]> Co-authored-by: afercia <[email protected]> Co-authored-by: ciampo <[email protected]>
1 parent 2eaed20 commit d516b23

File tree

4 files changed

+29
-35
lines changed

4 files changed

+29
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { Button, Tooltip } from '@wordpress/components';
4+
import { Button } from '@wordpress/components';
55
import { link, linkOff } from '@wordpress/icons';
66
import { __ } from '@wordpress/i18n';
77

88
export default function LinkedButton( { isLinked, ...props } ) {
99
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
1010

1111
return (
12-
<Tooltip text={ label }>
13-
<Button
14-
{ ...props }
15-
size="small"
16-
icon={ isLinked ? link : linkOff }
17-
iconSize={ 24 }
18-
aria-label={ label }
19-
/>
20-
</Tooltip>
12+
<Button
13+
{ ...props }
14+
size="small"
15+
icon={ isLinked ? link : linkOff }
16+
iconSize={ 24 }
17+
label={ label }
18+
/>
2119
);
2220
}

packages/components/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Enhancements
6+
7+
- `BorderBoxControl`, `BoxControl`: Remove `Tooltip` component from linked button ([#68498](https://github.com/WordPress/gutenberg/pull/68498)).
8+
59
### Internal
610

711
- `BoxControl`: Add runtime check for presets and presetKey ([#68385](https://github.com/WordPress/gutenberg/pull/68385)).

packages/components/src/border-box-control/border-box-control-linked-button/component.tsx

+9-14
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { __ } from '@wordpress/i18n';
88
* Internal dependencies
99
*/
1010
import Button from '../../button';
11-
import Tooltip from '../../tooltip';
12-
import { View } from '../../view';
1311
import type { WordPressComponentProps } from '../../context';
1412
import { contextConnect } from '../../context';
1513
import { useBorderBoxControlLinkedButton } from './hook';
@@ -25,18 +23,15 @@ const BorderBoxControlLinkedButton = (
2523
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
2624

2725
return (
28-
<Tooltip text={ label }>
29-
<View className={ className }>
30-
<Button
31-
{ ...buttonProps }
32-
size="small"
33-
icon={ isLinked ? link : linkOff }
34-
iconSize={ 24 }
35-
aria-label={ label }
36-
ref={ forwardedRef }
37-
/>
38-
</View>
39-
</Tooltip>
26+
<Button
27+
{ ...buttonProps }
28+
size="small"
29+
icon={ isLinked ? link : linkOff }
30+
iconSize={ 24 }
31+
label={ label }
32+
ref={ forwardedRef }
33+
className={ className }
34+
/>
4035
);
4136
};
4237

packages/components/src/box-control/linked-button.tsx

+8-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
88
* Internal dependencies
99
*/
1010
import Button from '../button';
11-
import Tooltip from '../tooltip';
1211

1312
export default function LinkedButton( {
1413
isLinked,
@@ -17,15 +16,13 @@ export default function LinkedButton( {
1716
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
1817

1918
return (
20-
<Tooltip text={ label }>
21-
<Button
22-
{ ...props }
23-
className="component-box-control__linked-button"
24-
size="small"
25-
icon={ isLinked ? link : linkOff }
26-
iconSize={ 24 }
27-
aria-label={ label }
28-
/>
29-
</Tooltip>
19+
<Button
20+
{ ...props }
21+
className="component-box-control__linked-button"
22+
size="small"
23+
icon={ isLinked ? link : linkOff }
24+
iconSize={ 24 }
25+
label={ label }
26+
/>
3027
);
3128
}

0 commit comments

Comments
 (0)