-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds the search page component and an API route for searching authors…
… and articles in the same query — issue #55
- Loading branch information
1 parent
da26112
commit c1000ba
Showing
14 changed files
with
685 additions
and
159 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
Large diffs are not rendered by default.
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
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,67 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import PropTypes from 'prop-types'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
|
||
import Card from '@material-ui/core/Card'; | ||
import CardContent from '@material-ui/core/CardContent'; | ||
import Grid from '@material-ui/core/Grid'; | ||
import Icon from '@material-ui/core/Icon'; | ||
|
||
|
||
const styles = theme => ({ | ||
authorDetails: { | ||
'& p': { marginBottom: theme.spacing.unit, marginTop: 0 }, | ||
color: theme.typography.body1.color | ||
}, | ||
card: { | ||
minWidth: 275, | ||
marginBottom: '9px' | ||
}, | ||
cardContent: { | ||
padding: 12 | ||
}, | ||
numberOfArticles: { | ||
color: '#999999' | ||
}, | ||
}); | ||
|
||
class AuthorCard extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
const { author, classes } = this.props; | ||
|
||
const CC_ST = {paddingBottom: 12} // Fix for .MuiCardContent-root-325:last-child adding 24px padding-bottom | ||
|
||
return ( | ||
<div className="ArticleCard"> | ||
<Link to={`/author/${author.slug}`}> | ||
<Card className={classes.card} raised> | ||
<CardContent className={classes.cardContent} style={CC_ST}> | ||
<Grid container> | ||
<Icon style={{fontSize: '3rem', marginRight: '1rem', color: '#999999'}}>person</Icon> | ||
|
||
<div className={classes.authorDetails}> | ||
<p style={{fontWeight: 'bold', letterSpacing: '0.025em'}}>{author.name}</p> | ||
<p><em>{author.affiliations}</em></p> | ||
<p className={classes.numberOfArticles}> | ||
{author.number_of_articles} {author.number_of_articles === 1 ? 'article' : 'articles'} | ||
</p> | ||
</div> | ||
</Grid> | ||
</CardContent> | ||
</Card> | ||
</Link> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
AuthorCard.defaultProps = { | ||
author: {} | ||
}; | ||
|
||
export default withStyles(styles)(AuthorCard); |
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.
c1000ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eplebel This commit has most of the work on the search results page. The search logic is pretty simple for the moment but it works. You can see a demo of it here: https://curate-science-staging-2.appspot.com/app/search?q=lebel
There's no search box yet but you can see results for different queries by changing the
lebel
query parameter.c1000ba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok great, thanks for the sneak peak, and just let me know when it's ready for testing, thanks!