mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
Fix overflow of quick search results with long repository names (#1739)
This commit is contained in:
2
gradle/changelog/quicksearch_overflow.yaml
Normal file
2
gradle/changelog/quicksearch_overflow.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: Fixed
|
||||
description: Fix overflow of quick search results with long repository names ([#1739](https://github.com/scm-manager/scm-manager/pull/1739))
|
||||
@@ -101,6 +101,10 @@ const ResultHeading = styled.div`
|
||||
padding: 0.375rem 0.5rem;
|
||||
`;
|
||||
|
||||
const DropdownMenu = styled.div`
|
||||
max-width: 20rem;
|
||||
`;
|
||||
|
||||
const Hits: FC<HitsProps> = ({ hits, index, clear }) => {
|
||||
const id = useCallback(namespaceAndName, [hits]);
|
||||
const [t] = useTranslation("commons");
|
||||
@@ -115,7 +119,10 @@ const Hits: FC<HitsProps> = ({ hits, index, clear }) => {
|
||||
{hits.map((hit, idx) => (
|
||||
<div key={id(hit)} onMouseDown={(e) => e.preventDefault()} onClick={clear}>
|
||||
<Link
|
||||
className={classNames("dropdown-item", "has-text-weight-medium", { "is-active": idx === index })}
|
||||
className={classNames("dropdown-item", "has-text-weight-medium", "is-ellipsis-overflow", {
|
||||
"is-active": idx === index,
|
||||
})}
|
||||
title={id(hit)}
|
||||
to={`/repo/${id(hit)}`}
|
||||
>
|
||||
{id(hit)}
|
||||
@@ -195,7 +202,7 @@ const useShowResultsOnFocus = () => {
|
||||
showResults,
|
||||
onClick: (e: MouseEvent<HTMLInputElement>) => e.stopPropagation(),
|
||||
onFocus: () => setShowResults(true),
|
||||
onBlur: () => setShowResults(false)
|
||||
onBlur: () => setShowResults(false),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -234,10 +241,10 @@ const OmniSearch: FC = () => {
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="dropdown-menu">
|
||||
<DropdownMenu className="dropdown-menu">
|
||||
{error ? <SearchErrorNotification error={error} /> : null}
|
||||
{!error && data ? <Hits clear={clearQuery} index={index} hits={data._embedded.hits} /> : null}
|
||||
</div>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
</Field>
|
||||
|
||||
Reference in New Issue
Block a user