Skip to content

Commit

Permalink
fix: display space description in media card
Browse files Browse the repository at this point in the history
closes #57
  • Loading branch information
juancarlosfarah committed May 27, 2019
1 parent 9b7a3e2 commit fdd9052
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/components/common/MediaCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const MediaCard = props => {
<Typography gutterBottom variant="h5" component="h2">
{name}
</Typography>
<Typography component="p">{text}</Typography>
<Typography component="p" dangerouslySetInnerHTML={{ __html: text }} />
</CardContent>
<CardActions>{button}</CardActions>
</Card>
Expand All @@ -41,8 +41,12 @@ MediaCard.propTypes = {
classes: PropTypes.shape({ media: PropTypes.string.isRequired }).isRequired,
name: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
text: PropTypes.string.isRequired,
text: PropTypes.string,
button: PropTypes.shape(Button).isRequired,
};

MediaCard.defaultProps = {
text: '',
};

export default withStyles(styles)(MediaCard);
5 changes: 3 additions & 2 deletions src/components/space/SpaceGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SpaceGrid extends Component {
const { spaces, classes, history } = this.props;

const MediaCards = spaces.map(space => {
const { id, name, image = {}, text } = space;
const { id, name, image = {}, description } = space;
const { replace } = history;
const ViewButton = (
<Button
Expand All @@ -90,6 +90,7 @@ class SpaceGrid extends Component {
color="primary"
id={Number(id)}
onClick={() => replace(`/space/${id}`)}
fullWidth
>
<RemoveRedEyeIcon className={classes.leftIcon} />
View
Expand All @@ -101,7 +102,7 @@ class SpaceGrid extends Component {
key={id}
name={name}
image={this.generateThumbnail({ image })}
text={text}
text={description}
button={ViewButton}
/>
</Grid>
Expand Down

0 comments on commit fdd9052

Please sign in to comment.