Skip to content

Commit

Permalink
Fix Navigation link control overlapping issue (#59065)
Browse files Browse the repository at this point in the history
* Fix nagivation link control overlapping issue

* Addressed feedback

* use variable insted fixed number in spacing
  • Loading branch information
akasunil authored and getdave committed Feb 27, 2024
1 parent 71746c4 commit 667797e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import { useCopyToClipboard } from '@wordpress/compose';
import { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';
import { Icon, globe, info, linkOff, edit, copySmall } from '@wordpress/icons';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
import { useDispatch } from '@wordpress/data';
import { useDispatch, useSelect } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
Expand All @@ -33,6 +34,12 @@ export default function LinkPreview( {
hasUnlinkControl = false,
onRemove,
} ) {
const showIconLabels = useSelect(
( select ) =>
select( preferencesStore ).get( 'core', 'showIconLabels' ),
[]
);

// Avoid fetching if rich previews are not desired.
const showRichPreviews = hasRichPreviews ? value?.url : null;

Expand Down Expand Up @@ -139,7 +146,7 @@ export default function LinkPreview( {
label={ sprintf(
// Translators: %s is a placeholder for the link URL and an optional colon, (if a Link URL is present).
__( 'Copy link%s' ), // Ends up looking like "Copy link: https://example.com".
isEmptyURL ? '' : ': ' + value.url
isEmptyURL || showIconLabels ? '' : ': ' + value.url
) }
ref={ ref }
disabled={ isEmptyURL }
Expand Down
9 changes: 9 additions & 0 deletions packages/block-editor/src/components/link-control/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ $block-editor-link-control-number-of-actions: 1;
content: attr(aria-label);
}
}

.block-editor-link-control__search-item-top {
gap: $grid-unit-10;

.components-button.has-icon {
min-width: inherit;
width: min-content;
}
}
}
}

Expand Down

0 comments on commit 667797e

Please sign in to comment.