[WIP] Change map with MenuItem to PaginatedList

This commit is contained in:
CuriousCorrelation authored and Tom Moor committed 2022-07-17 12:22:25 +01:00
1 parent 0a0946cf12
commit b6813272c1
1 file changed
+29 -20
+29 -20
View File
@@ -5,6 +5,9 @@ import Button, { Inner } from "~/components/Button";
import ContextMenu from "~/components/ContextMenu";
import MenuItem from "~/components/ContextMenu/MenuItem";
import Text from "~/components/Text";
import { Outline } from "./Input";
import InputSearch from "./InputSearch";
import PaginatedList, { PaginatedItem } from "./PaginatedList";
type TFilterOption = {
key: string;
@@ -47,26 +50,32 @@ const FilterOptions = ({
)}
</MenuButton>
<ContextMenu aria-label={defaultLabel} {...menu}>
{options.map((option) => (
<MenuItem
key={option.key}
onClick={() => {
onSelect(option.key);
menu.hide();
}}
selected={option.key === activeKey}
{...menu}
>
{option.note ? (
<LabelWithNote>
{option.label}
<Note>{option.note}</Note>
</LabelWithNote>
) : (
option.label
)}
</MenuItem>
))}
{searchable && <StyledInputSearch onChange={handleFilter} />}
{searchable && <br />}
<PaginatedList
items={filteredData}
fetch={paginateFetch}
renderItem={(option: TFilterOption) => (
<MenuItem
key={option.key}
onClick={() => {
onSelect(option.key);
menu.hide();
}}
selected={option.key === activeKey}
{...menu}
>
{option.note ? (
<LabelWithNote>
{option.label}
<Note>{option.note}</Note>
</LabelWithNote>
) : (
option.label
)}
</MenuItem>
)}
/>
</ContextMenu>
</Wrapper>
);