Skip to content

Commit

Permalink
fix: Removed extra tooltips component in button component
Browse files Browse the repository at this point in the history
  • Loading branch information
im3dabasia committed Jan 6, 2025
1 parent e5dca54 commit f3012df
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
/**
* WordPress dependencies
*/
import { Button, Tooltip } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { link, linkOff } from '@wordpress/icons';
import { __ } from '@wordpress/i18n';

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

return (
<Tooltip text={ label }>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../../button';
import Tooltip from '../../tooltip';
import { View } from '../../view';
import type { WordPressComponentProps } from '../../context';
import { contextConnect } from '../../context';
Expand All @@ -25,18 +24,16 @@ const BorderBoxControlLinkedButton = (
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<View className={ className }>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
ref={ forwardedRef }
/>
</View>
</Tooltip>
<View className={ className }>
<Button
{ ...buttonProps }
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
ref={ forwardedRef }
/>
</View>
);
};

Expand Down
21 changes: 9 additions & 12 deletions packages/components/src/box-control/linked-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import Button from '../button';
import Tooltip from '../tooltip';

export default function LinkedButton( {
isLinked,
...props
}: { isLinked?: boolean } & React.ComponentProps< typeof Button > ) {
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
const label = isLinked ? __( 'Unlink sides44' ) : __( 'Link sides' );

return (
<Tooltip text={ label }>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
aria-label={ label }
/>
</Tooltip>
<Button
{ ...props }
className="component-box-control__linked-button"
size="small"
icon={ isLinked ? link : linkOff }
iconSize={ 24 }
label={ label }
/>
);
}

0 comments on commit f3012df

Please sign in to comment.