Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Navigation link control overlapping issue #59065

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ $block-editor-link-control-number-of-actions: 1;
content: attr(aria-label);
}
}

.block-editor-link-control__search-item-top {
.components-button.has-icon {
min-width: 50px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a min-width is width is set?

width: 50px;
padding: 0 5px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding padding on both sides, what do you think about adding a gap to the parent element? This means we don't add extra padding on the left and right of the buttons which makes a better use of the space IMO

Copy link
Member Author

@akasunil akasunil Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for suggestions, I have updated css to make better use of space.

}
}
}
}

Expand Down
Loading