fix: Virtualize move document listbox (#1650)

* fix: Virtualize move document listbox
closes #1645
This commit is contained in:
Tom Moor
2020-11-12 22:02:56 -08:00
committed by GitHub
parent 32d3053002
commit 7bdcba46b8
4 changed files with 83 additions and 61 deletions

View File

@ -14,6 +14,7 @@ type Props = {
document?: ?Document,
collection: ?Collection,
onSuccess?: () => void,
style?: Object,
ref?: (?React.ElementRef<"div">) => void,
};
@ -34,13 +35,20 @@ class PathToDocument extends React.Component<Props> {
};
render() {
const { result, collection, document, ref } = this.props;
const { result, collection, document, ref, style } = this.props;
const Component = document ? ResultWrapperLink : ResultWrapper;
if (!result) return <div />;
return (
<Component ref={ref} onClick={this.handleClick} href="" selectable>
<Component
ref={ref}
onClick={this.handleClick}
href=""
style={style}
role="option"
selectable
>
{collection && <CollectionIcon collection={collection} />}
&nbsp;
{result.path
@ -72,21 +80,27 @@ const StyledGoToIcon = styled(GoToIcon)`
const ResultWrapper = styled.div`
display: flex;
margin-bottom: 10px;
margin-left: -4px;
user-select: none;
color: ${(props) => props.theme.text};
cursor: default;
svg {
flex-shrink: 0;
}
`;
const ResultWrapperLink = styled(ResultWrapper.withComponent("a"))`
margin: 0 -8px;
padding: 8px 4px;
${DocumentTitle} {
display: none;
}
svg {
flex-shrink: 0;
}
&:hover,
&:active,
&:focus {