feat: Search shared documents (#3126)

* provide a type-ahead search input on shared document pages that allow search of child document tree
* improve keyboard navigation handling of all search views
* improve coloring on dark mode list selection states
* refactor PaginatedList component to eliminate edge cases
This commit is contained in:
Nan Yu
2022-04-08 10:40:51 -07:00
committed by GitHub
parent 5fb5e69181
commit 75a868e5e8
22 changed files with 804 additions and 168 deletions

View File

@@ -8,7 +8,7 @@ import useBoolean from "~/hooks/useBoolean";
import useKeyDown from "~/hooks/useKeyDown";
import { isModKey } from "~/utils/keyboard";
import { searchPath } from "~/utils/routeHelpers";
import Input from "./Input";
import Input, { Outline } from "./Input";
type Props = {
source: string;
@@ -30,7 +30,7 @@ function InputSearchPage({
collectionId,
source,
}: Props) {
const inputRef = React.useRef<Input>(null);
const inputRef = React.useRef<HTMLInputElement>(null);
const theme = useTheme();
const history = useHistory();
const { t } = useTranslation();
@@ -67,7 +67,7 @@ function InputSearchPage({
return (
<InputMaxWidth
ref={inputRef}
innerRef={inputRef}
type="search"
placeholder={placeholder || `${t("Search")}`}
value={value}
@@ -89,6 +89,10 @@ function InputSearchPage({
const InputMaxWidth = styled(Input)`
max-width: 30vw;
${Outline} {
border-radius: 16px;
}
`;
export default observer(InputSearchPage);