Files
transform/components/Navigator.tsx
Ritesh Kumar 1bd559514b Transform 2.0 (#101)
* 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:
2019-07-18 19:07:48 +05:30

86 lines
2.5 KiB
TypeScript

import React, { useCallback, Fragment, useEffect } from "react";
import { Heading, Pane, Text, Autocomplete, SearchInput } from "evergreen-ui";
import { categorizedRoutes, Route, routes } from "@utils/routes";
import Link from "next/link";
import { useRouter } from "next/router";
import SearchBox from "@components/Searchbox";
export default function() {
const router = useRouter();
return (
<Pane
width={240}
height={"calc(100vh - 40px)"}
borderRight
display="flex"
flexDirection="column"
paddingTop={20}
>
<Pane paddingX={15}>
<SearchBox />
</Pane>
<Pane
display="flex"
flex={1}
overflowY="scroll"
flexDirection="column"
paddingBottom={10}
>
{categorizedRoutes.map(route => {
return (
<Fragment key={route.category}>
<Pane paddingX={10} marginTop={15} marginBottom={2}>
<Heading marginLeft={5} size={400}>
{route.category}
</Heading>
</Pane>
{(route.content as Route[]).map((a: Route) => {
const isActive = router.pathname === a.path;
return (
<Link key={a.label} href={a.path}>
<a
style={{
textDecoration: "none"
}}
>
<Pane
paddingLeft={16}
paddingY={3}
backgroundColor={isActive ? "#f3f3f3" : undefined}
borderLeft={
isActive
? "3px solid #009688"
: "3px solid transparent"
}
css={{
"&:hover": {
backgroundColor: "#f5f5f5"
}
}}
>
<Text fontSize={13}>{a.label}</Text>
</Pane>
</a>
</Link>
);
})}
</Fragment>
);
})}
</Pane>
<Pane paddingY={15} background="#f6f6f6" borderTop>
<Heading size={400} textAlign="center">
Created by{" "}
<Link href="https://twitter.com/ritz078">
<a target="_blank">@ritz078</a>
</Link>
</Heading>
</Pane>
</Pane>
);
}