-
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
1 parent
b863b93
commit 9b2e5fc
Showing
8 changed files
with
242 additions
and
62 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
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
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,49 @@ | ||
import React from 'react'; | ||
import { IListItem } from '../constants'; | ||
import { Checkbox, TextField } from '@material-ui/core/'; | ||
|
||
export default function Filter(props: IFilterProps) { | ||
const [state, setState] = React.useState({ | ||
items: props.items, | ||
sortChecked: true, | ||
sortEnable: props.sortEnable, | ||
filterEnable: props.filterEnable | ||
}); | ||
|
||
const handleChange = (name: string) => (event: React.ChangeEvent<HTMLInputElement>) => { | ||
const isChecked = event.target.checked; | ||
console.log('>>>>>isChecked>>>>>', isChecked); | ||
isChecked ? props.items.sort() : props.items.reverse(); | ||
setState({ | ||
...state, | ||
[name]: isChecked | ||
}); | ||
props.onChangeFilter(); | ||
}; | ||
|
||
return ( | ||
<div className="filter"> | ||
<TextField className="text-filter" placeholder="Text Filter" /> | ||
<span className="sorting"> | ||
sort | ||
<Checkbox checked={state.sortChecked} | ||
onChange={handleChange('sortChecked')} | ||
value="sortChecked" /> | ||
</span> | ||
</div> | ||
) | ||
} | ||
|
||
export interface IFilterProps { | ||
items: IListItem[], | ||
sortEnable?: boolean, | ||
filterEnable?: boolean, | ||
onChangeFilter: Function | ||
} | ||
|
||
export interface IFilterState { | ||
sortChecked: boolean | ||
} | ||
|
||
export enum filterTypes { | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import { IListItem } from '../constants' | ||
import FlagIcon from './FlagIcon' | ||
import { Grid } from '@material-ui/core' | ||
|
||
export default function ItemDetails(props: IitemDetailsProps) { | ||
return ( | ||
<div className="item-details"> | ||
|
||
<h1>INFO</h1> | ||
<Grid container spacing={3}> | ||
<Grid className="itemName" item xs={6}> | ||
<div>NAME: </div> | ||
<br /> | ||
<div>FLAGS: </div> | ||
</Grid> | ||
<Grid item xs={6}> | ||
<div> {props.selectedItem && props.selectedItem.name}</div> | ||
<div className="itemFlags"> | ||
{props.selectedItem && props.selectedItem.flags.map((flag) => ( | ||
<FlagIcon icon={flag} /> | ||
))} | ||
</div> | ||
</Grid> | ||
</Grid> | ||
</div> | ||
) | ||
} | ||
export interface IitemDetailsProps { | ||
selectedItem?: IListItem | ||
} |
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
Oops, something went wrong.