Skip to content

Commit

Permalink
fix spacing of search items in narrow contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiankaegy committed Aug 30, 2023
1 parent f9f5952 commit aed7b9e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions components/content-search/SearchItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import PropTypes from 'prop-types';
import styled from '@emotion/styled';
import { safeDecodeURI, filterURLForDisplay } from '@wordpress/url';
import { decodeEntities } from '@wordpress/html-entities';
import { Button, TextHighlight, Tooltip } from '@wordpress/components';
import {
Button,
TextHighlight,
Tooltip,
__experimentalTruncate as Truncate,
} from '@wordpress/components';
import { getTextContent, create } from '@wordpress/rich-text';

const ButtonStyled = styled(Button)`
Expand All @@ -11,8 +16,9 @@ const ButtonStyled = styled(Button)`
width: 100%;
justify-content: space-between;
align-items: center;
border-radius: 2px !important;
padding: 2em 0.7em !important;
border-radius: 2px;
height: auto !important;
padding: 0.3em 0.7em;
overflow: hidden;
&:hover {
Expand All @@ -31,6 +37,11 @@ const ButtonStyled = styled(Button)`
text-transform: capitalize;
border-radius: 2px;
}
.block-editor-link-control__search-item-header {
display: flex;
flex-direction: column;
}
`;

/**
Expand Down Expand Up @@ -90,7 +101,9 @@ const SearchItem = ({
paddingRight: !showType ? 0 : null,
}}
>
{filterURLForDisplay(safeDecodeURI(suggestion.url)) || ''}
<Truncate numberOfLines={1} limit={55} ellipsizeMode="middle">
{filterURLForDisplay(safeDecodeURI(suggestion.url)) || ''}
</Truncate>
</span>
</span>
{showType && (
Expand Down

0 comments on commit aed7b9e

Please sign in to comment.