-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
83 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Input, Link, Badge, Box, TabPanel } from "@chakra-ui/react"; | ||
import React from "react"; | ||
|
||
type Props = { | ||
versions: string[]; | ||
onClickVersion: (version: string) => void; | ||
}; | ||
|
||
export const FilterTab = (props: Props) => { | ||
const [filteredVersion, setFilteredVersion] = React.useState<string[]>( | ||
props.versions | ||
); | ||
const [filter, setFilter] = React.useState<string>(""); | ||
|
||
const onChangeFilter = (v: string) => { | ||
setFilter(v); | ||
setFilteredVersion(props.versions.filter(version => version.includes(v))); | ||
}; | ||
|
||
return ( | ||
<TabPanel> | ||
<Box display="flex" flexDirection="column"> | ||
<Input | ||
placeholder="Version" | ||
value={filter} | ||
onChange={e => onChangeFilter(e.target.value)} | ||
/> | ||
<Box | ||
display="flex" | ||
flexDirection="row" | ||
marginTop="6" | ||
flexWrap="wrap" | ||
justifyContent="left" | ||
> | ||
{filteredVersion.map(version => ( | ||
<Box key={`list-${version}`} margin="2"> | ||
<Link onClick={() => props.onClickVersion(version)}> | ||
<Badge fontSize="medium">{version}</Badge> | ||
</Link> | ||
</Box> | ||
))} | ||
</Box> | ||
</Box> | ||
</TabPanel> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { TabPanel } from "@chakra-ui/react"; | ||
import ChakraUIRenderer from "chakra-ui-markdown-renderer"; | ||
import ReactMarkdown from "react-markdown"; | ||
import rehypeRaw from "rehype-raw"; | ||
import React from "react"; | ||
|
||
type Props = { | ||
info: string; | ||
}; | ||
|
||
const Tab = (props: Props) => { | ||
return ( | ||
<TabPanel> | ||
<ReactMarkdown | ||
components={ChakraUIRenderer()} | ||
children={props.info} | ||
rehypePlugins={[rehypeRaw]} | ||
/> | ||
</TabPanel> | ||
); | ||
}; | ||
|
||
export const MemoizeTab = React.memo(Tab); |