-
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.
Code refactored, table search rewritten using API calls, toastify rep…
…laced with ant notification
- Loading branch information
1 parent
95b2424
commit 02487dc
Showing
14 changed files
with
212 additions
and
202 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
import { notification } from 'antd' | ||
|
||
const Notification = { | ||
error: data => | ||
notification.error({ | ||
message: 'Error', | ||
description: `${data}`, | ||
}), | ||
success: data => | ||
notification.success({ | ||
message: 'Success', | ||
description: `${data}`, | ||
}), | ||
} | ||
|
||
export default Notification |
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,45 @@ | ||
import React, { useState } from 'react' | ||
import { Button, Input } from 'antd' | ||
|
||
const Search = ({ handleSearch, getData, dataIndex }) => { | ||
const [searchRef, setSearchRef] = useState({}) | ||
return ( | ||
<div className="search-container"> | ||
<div className="search-input-container"> | ||
<Input.Search | ||
placeholder={`Input search ${dataIndex}`} | ||
onSearch={phrase => { | ||
if (phrase) handleSearch(dataIndex, phrase) | ||
}} | ||
ref={c => setSearchRef(c)} | ||
/> | ||
</div> | ||
<div> | ||
<Button | ||
type="primary" | ||
onClick={() => { | ||
const phrase = searchRef.input.state.value | ||
if (phrase) handleSearch(dataIndex, phrase) | ||
}} | ||
icon="search" | ||
size="small" | ||
className="search-input-confirm-btn" | ||
> | ||
Search | ||
</Button> | ||
<Button | ||
onClick={() => { | ||
searchRef.input.state.value = '' | ||
getData() | ||
}} | ||
size="small" | ||
className="search-input-reset-btn" | ||
> | ||
Reset | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Search |
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.