-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #436 from mlibrary/history-react-router-dom-update…
…-part-1 `history` and `react-router-update` - Part 1
- Loading branch information
Showing
11 changed files
with
251 additions
and
414 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 |
---|---|---|
@@ -1,25 +1,26 @@ | ||
import React from 'react'; | ||
import { useLocation } from 'react-router-dom'; | ||
import { Anchor } from '../../../reusable'; | ||
import PropTypes from 'prop-types'; | ||
import { withRouter } from 'react-router-dom'; | ||
|
||
function GoToList (props) { | ||
if (!props.list) return null; | ||
function GoToList ({ list, datastore }) { | ||
const location = useLocation(); | ||
|
||
if (!list) return null; | ||
|
||
return ( | ||
<section className='lists-link-container lists-link' aria-live='polite'> | ||
<div className='list-info'> | ||
<p className='lists-content'>Go to <Anchor to={`/${props.datastore.slug}/list${props.location.search}`}>My Temporary {props.datastore.name} List</Anchor> to email, text, and export citations.</p> | ||
<p className='lists-content'>Go to <Anchor to={`/${datastore.slug}/list${location.search}`}>My Temporary {datastore.name} List</Anchor> to email, text, and export citations.</p> | ||
</div> | ||
<p className='lists-count-tag'><span className='strong'>{props.list?.length || 0}</span> in list</p> | ||
<p className='lists-count-tag'><span className='strong'>{list.length || 0}</span> in list</p> | ||
</section> | ||
); | ||
} | ||
|
||
GoToList.propTypes = { | ||
location: PropTypes.object, | ||
list: PropTypes.array, | ||
datastore: PropTypes.object | ||
}; | ||
|
||
export default withRouter(GoToList); | ||
export default GoToList; |
Oops, something went wrong.