mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
* feat(init): added EditorPanel with prettier, copy and settings support * chore(static): ignore static * feat: added navigator * feat: * feat(settings): added sessionStorage support for settings * feat(message): add messaging support in editors * feat(preview): added support for preview panel * fix(settings): use localstorage for settings instead of session storage * feat: * feat(css-to-js): implemented React section * feat(schema): add json to schema conversions * feat(others): implemented xml, yaml and markdown conversions * feat(babel): added flow to typescript converter * feat(graphql): implemented graphql to typescript * feat(graphql): added some transformations * fix: add support for different default value in one language * feat(graphql): added components, resolver signatures and mongodb * feat: * scala case class * fix(memory): worker-loader patch applied to fix memory overflow crash * feat: added json schema to typescript * icon: <GraphQLIcon />, * feat(navigator): shorter naming and new categories * route fixes * navigator * perf(workers): create separate file and remove fallback * fix(navigator): completed * build(snack): * fixes * fixes * fix(safari): * added json-to-mobx-state tree * fix(native): snacksession * fixes * added logo * navigator * fixes * custom header * fixes * refactor(settings): move settings to left side * feat: set up redirects * feat(seo): added title and description * feat(error): added custom error page * ga-script * feat: * fixes * fixe * fixes * fixes * fix:
38 lines
957 B
TypeScript
38 lines
957 B
TypeScript
import { routes } from "@utils/routes";
|
|
import { Autocomplete, SearchInput } from "evergreen-ui";
|
|
import React, { useCallback } from "react";
|
|
import { useRouter } from "next/router";
|
|
|
|
const SearchBox: React.FunctionComponent<{}> = () => {
|
|
const router = useRouter();
|
|
|
|
const onSearchSelect = useCallback(changedItem => {
|
|
const route = routes.find(route => changedItem === route.searchTerm);
|
|
router.push(route.path);
|
|
}, []);
|
|
|
|
return (
|
|
<Autocomplete
|
|
onChange={onSearchSelect}
|
|
items={routes.map(a => a.searchTerm)}
|
|
width="100%"
|
|
>
|
|
{props => {
|
|
const { getInputProps, getRef, inputValue } = props;
|
|
return (
|
|
<SearchInput
|
|
width="100%"
|
|
marginBottom={10}
|
|
placeholder="Search"
|
|
value={inputValue}
|
|
innerRef={getRef}
|
|
{...getInputProps()}
|
|
/>
|
|
);
|
|
}}
|
|
</Autocomplete>
|
|
);
|
|
};
|
|
|
|
export default SearchBox;
|