-
Notifications
You must be signed in to change notification settings - Fork 8
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
6 changed files
with
102 additions
and
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import React from 'react'; | ||
import { withRouter } from 'react-router-dom'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import SearchContextProvider from './Hooks/searchContext'; | ||
import BooksPage from './BooksPage'; | ||
import './BooksPage.scss'; | ||
|
||
const BooksPageWrapper = () => ( | ||
const BooksPageWrapper = ({ history }) => ( | ||
<SearchContextProvider> | ||
<BooksPage /> | ||
<BooksPage history={history} /> | ||
</SearchContextProvider> | ||
); | ||
|
||
BooksPageWrapper.propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
}; | ||
|
||
export default withRouter(BooksPageWrapper); |
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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import React from 'react'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import Search from '../search/Search'; | ||
import SearchButton from '../SearchButton/SearchButton'; | ||
import Dropdown from '../../helpers/Dropdown/Dropdown'; | ||
import './FilterBox.scss'; | ||
|
||
const FilterBox = () => ( | ||
const FilterBox = ({ history }) => ( | ||
<div className="filter-box"> | ||
<Search className="book-search" name="Author" id="author" /> | ||
<Search className="book-search" name="Title" id="title" /> | ||
<Search className="book-search" name="Keyword" id="keyword" /> | ||
<Dropdown label="Genre" id="genre" name="Genres" /> | ||
<SearchButton /> | ||
<SearchButton history={history} /> | ||
</div> | ||
); | ||
|
||
FilterBox.propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
}; | ||
export default FilterBox; |
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 |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import React, { useContext } from 'react'; | ||
import ReactRouterPropTypes from 'react-router-prop-types'; | ||
import './SearchButton.scss'; | ||
import { SearchContext } from '../Hooks/searchContext'; | ||
|
||
const SearchButton = () => { | ||
const SearchButton = ({ history }) => { | ||
const { handleSearch } = useContext(SearchContext); | ||
return ( | ||
<button type="button" className="btn search-btn" onClick={handleSearch}>Search</button> | ||
<button type="button" className="btn search-btn" onClick={() => handleSearch(history)}>Search</button> | ||
); | ||
}; | ||
|
||
SearchButton.propTypes = { | ||
history: ReactRouterPropTypes.history.isRequired, | ||
}; | ||
|
||
export default SearchButton; |
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