-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add customizable headers, interfaces for match history * actually apply filters * Prettier * Graphical improvements --------- Co-authored-by: Ryan Sullivan <mrsulliv@gmail.com>
- Loading branch information
1 parent
b8b7bb7
commit daa1a25
Showing
3 changed files
with
237 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Button, Checkbox, Flex, Group, List, Popover, Space, Text } from "@mantine/core"; | ||
import { IconFilter } from "@tabler/icons"; | ||
import { FilterInformation } from "./player-recent-matches"; | ||
|
||
type FilterableHeaderProps = { | ||
title: string; | ||
options: { [key: string | number]: FilterInformation }; | ||
onChange: (filter: string | number) => void; | ||
onReset: () => void; | ||
}; | ||
const FilterableHeader = ({ options, title, onChange, onReset }: FilterableHeaderProps) => { | ||
function handleCheckboxChange(filter: string | number) { | ||
onChange(filter); | ||
} | ||
|
||
return ( | ||
<Popover position="bottom" withArrow shadow="md"> | ||
<Popover.Target> | ||
<Group position="center"> | ||
<Flex> | ||
<Text>{title}</Text> | ||
<IconFilter cursor="pointer" /> | ||
</Flex> | ||
</Group> | ||
</Popover.Target> | ||
<Popover.Dropdown> | ||
<List listStyleType="none" style={{ textAlign: "left" }}> | ||
{Object.entries(options).map(([filter, { checked, label }]) => { | ||
return ( | ||
<List.Item key={label}> | ||
<Checkbox | ||
label={label} | ||
checked={checked} | ||
styles={{ input: { cursor: "pointer" }, label: { cursor: "pointer" } }} | ||
onChange={() => handleCheckboxChange(filter)} | ||
/> | ||
</List.Item> | ||
); | ||
})} | ||
</List> | ||
<Space h={"xs"} /> | ||
<Group position="left"> | ||
<Button onClick={onReset} size="xs"> | ||
Reset | ||
</Button> | ||
</Group> | ||
</Popover.Dropdown> | ||
</Popover> | ||
); | ||
}; | ||
|
||
export default FilterableHeader; |
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
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