React Material-UI not justify-content will not work for all of my Cards
up vote
0
down vote
favorite
I'm having really bizarre issue with my code. I am using React to map a Redux state onto Material-UI cards. When I was testing different styling on my cards the other day I was able to make different classes and update the card appearance however I liked. However today when I added new information to my database the new cards will not take all of the styling from the Material-UI database. Specifically it seems like the new cards are not effected by justifyContent.
This is a difficult issue for me to explain but basically I have a database of information being mapped onto multiple different cards. Some of the cards are accepting the Material-UI styling other cards are not.
I would like to post a jsfiddle but I would need to link it to my database and I'm not sure that can be done.
Here is the page which is mapping my redux state:
import React, Component from 'react';
import connect from 'react-redux';
import ProjectItem from '../ProjectItem/ProjectItem'
import withRouter from 'react-router-dom'
import Header from '../Header/Header'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
bodyContent:
marginTop: 100,
)
class ProjectPage extends Component
//This calls the getProjects function on the page load
componentDidMount()
this.getProjects();
//This function dispatches an action to our index page
getProjects = () =>
console.log('running')
this.props.dispatch( type: 'GET_PROJECT')
render()
const classes = this.props
return (
<div>
<Header />
<div className= classes.bodyContent>
this.props.reduxState.projects.map((project,index) =>
return(
<ProjectItem
key = index
id = project.id
name =project.name
description = project.description
thumbnail = project.thumbnail
website = project.website
github = project.github
tag_id = project.tag_id
/>
)
)
</div>
</div>
);
export default withRouter(connect(mapReduxStateToProps)(withStyles(styles)(ProjectPage)));
And here is the page with my styling.
import React, Component from 'react';
import connect from 'react-redux';
import './ProjectItem.css'
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia'
import CardContent from '@material-ui/core/CardContent'
import Typography from '@material-ui/core/Typography'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
card:
display: 'flex',
width: 550,
alignSelf: 'center',
height: 150,
paddingTop: 5,
paddingBottom:5,
,
details:
display: 'flex',
flexDirection: 'column'
,
thumbnail:
height: 150,
minWidth: 150
,
contentBody:
justifyContent: 'space-between',
textAlign: 'left',
alignItems: 'center',
display : 'inline-flex',
,
toolbar: theme.mixins.toolbar
)
class ProjectItem extends Component
render()
const classes = this.props
return (
<div className='container'>
<Card className=classes.card>
<CardMedia
className=classes.thumbnail
image=this.props.thumbnail
title="Project Image"
/>
<div className=classes.details>
<CardContent className=classes.contentBody>
<Typography variant='h5'>
this.props.name
</Typography>
<Typography variant='h6'>
<a href=this.props.github>GitHub</a>
</Typography>
<Typography variant='h6'>
<a href=this.props.website>Website</a>
</Typography>
<Typography variant='h6'>
this.props.tag_id
</Typography>
</CardContent>
<CardContent className=classes.content>
<Typography>
this.props.description
</Typography>
</CardContent>
</div>
</Card>
</div>
);
export default connect(mapReduxStateToProps)(withStyles(styles)(ProjectItem));
reactjs redux material-ui
add a comment |
up vote
0
down vote
favorite
I'm having really bizarre issue with my code. I am using React to map a Redux state onto Material-UI cards. When I was testing different styling on my cards the other day I was able to make different classes and update the card appearance however I liked. However today when I added new information to my database the new cards will not take all of the styling from the Material-UI database. Specifically it seems like the new cards are not effected by justifyContent.
This is a difficult issue for me to explain but basically I have a database of information being mapped onto multiple different cards. Some of the cards are accepting the Material-UI styling other cards are not.
I would like to post a jsfiddle but I would need to link it to my database and I'm not sure that can be done.
Here is the page which is mapping my redux state:
import React, Component from 'react';
import connect from 'react-redux';
import ProjectItem from '../ProjectItem/ProjectItem'
import withRouter from 'react-router-dom'
import Header from '../Header/Header'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
bodyContent:
marginTop: 100,
)
class ProjectPage extends Component
//This calls the getProjects function on the page load
componentDidMount()
this.getProjects();
//This function dispatches an action to our index page
getProjects = () =>
console.log('running')
this.props.dispatch( type: 'GET_PROJECT')
render()
const classes = this.props
return (
<div>
<Header />
<div className= classes.bodyContent>
this.props.reduxState.projects.map((project,index) =>
return(
<ProjectItem
key = index
id = project.id
name =project.name
description = project.description
thumbnail = project.thumbnail
website = project.website
github = project.github
tag_id = project.tag_id
/>
)
)
</div>
</div>
);
export default withRouter(connect(mapReduxStateToProps)(withStyles(styles)(ProjectPage)));
And here is the page with my styling.
import React, Component from 'react';
import connect from 'react-redux';
import './ProjectItem.css'
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia'
import CardContent from '@material-ui/core/CardContent'
import Typography from '@material-ui/core/Typography'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
card:
display: 'flex',
width: 550,
alignSelf: 'center',
height: 150,
paddingTop: 5,
paddingBottom:5,
,
details:
display: 'flex',
flexDirection: 'column'
,
thumbnail:
height: 150,
minWidth: 150
,
contentBody:
justifyContent: 'space-between',
textAlign: 'left',
alignItems: 'center',
display : 'inline-flex',
,
toolbar: theme.mixins.toolbar
)
class ProjectItem extends Component
render()
const classes = this.props
return (
<div className='container'>
<Card className=classes.card>
<CardMedia
className=classes.thumbnail
image=this.props.thumbnail
title="Project Image"
/>
<div className=classes.details>
<CardContent className=classes.contentBody>
<Typography variant='h5'>
this.props.name
</Typography>
<Typography variant='h6'>
<a href=this.props.github>GitHub</a>
</Typography>
<Typography variant='h6'>
<a href=this.props.website>Website</a>
</Typography>
<Typography variant='h6'>
this.props.tag_id
</Typography>
</CardContent>
<CardContent className=classes.content>
<Typography>
this.props.description
</Typography>
</CardContent>
</div>
</Card>
</div>
);
export default connect(mapReduxStateToProps)(withStyles(styles)(ProjectItem));
reactjs redux material-ui
1
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Did you adddisplay : 'inline-flex'
between you tests?
– Sylvain Biehler
Nov 12 at 12:42
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having really bizarre issue with my code. I am using React to map a Redux state onto Material-UI cards. When I was testing different styling on my cards the other day I was able to make different classes and update the card appearance however I liked. However today when I added new information to my database the new cards will not take all of the styling from the Material-UI database. Specifically it seems like the new cards are not effected by justifyContent.
This is a difficult issue for me to explain but basically I have a database of information being mapped onto multiple different cards. Some of the cards are accepting the Material-UI styling other cards are not.
I would like to post a jsfiddle but I would need to link it to my database and I'm not sure that can be done.
Here is the page which is mapping my redux state:
import React, Component from 'react';
import connect from 'react-redux';
import ProjectItem from '../ProjectItem/ProjectItem'
import withRouter from 'react-router-dom'
import Header from '../Header/Header'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
bodyContent:
marginTop: 100,
)
class ProjectPage extends Component
//This calls the getProjects function on the page load
componentDidMount()
this.getProjects();
//This function dispatches an action to our index page
getProjects = () =>
console.log('running')
this.props.dispatch( type: 'GET_PROJECT')
render()
const classes = this.props
return (
<div>
<Header />
<div className= classes.bodyContent>
this.props.reduxState.projects.map((project,index) =>
return(
<ProjectItem
key = index
id = project.id
name =project.name
description = project.description
thumbnail = project.thumbnail
website = project.website
github = project.github
tag_id = project.tag_id
/>
)
)
</div>
</div>
);
export default withRouter(connect(mapReduxStateToProps)(withStyles(styles)(ProjectPage)));
And here is the page with my styling.
import React, Component from 'react';
import connect from 'react-redux';
import './ProjectItem.css'
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia'
import CardContent from '@material-ui/core/CardContent'
import Typography from '@material-ui/core/Typography'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
card:
display: 'flex',
width: 550,
alignSelf: 'center',
height: 150,
paddingTop: 5,
paddingBottom:5,
,
details:
display: 'flex',
flexDirection: 'column'
,
thumbnail:
height: 150,
minWidth: 150
,
contentBody:
justifyContent: 'space-between',
textAlign: 'left',
alignItems: 'center',
display : 'inline-flex',
,
toolbar: theme.mixins.toolbar
)
class ProjectItem extends Component
render()
const classes = this.props
return (
<div className='container'>
<Card className=classes.card>
<CardMedia
className=classes.thumbnail
image=this.props.thumbnail
title="Project Image"
/>
<div className=classes.details>
<CardContent className=classes.contentBody>
<Typography variant='h5'>
this.props.name
</Typography>
<Typography variant='h6'>
<a href=this.props.github>GitHub</a>
</Typography>
<Typography variant='h6'>
<a href=this.props.website>Website</a>
</Typography>
<Typography variant='h6'>
this.props.tag_id
</Typography>
</CardContent>
<CardContent className=classes.content>
<Typography>
this.props.description
</Typography>
</CardContent>
</div>
</Card>
</div>
);
export default connect(mapReduxStateToProps)(withStyles(styles)(ProjectItem));
reactjs redux material-ui
I'm having really bizarre issue with my code. I am using React to map a Redux state onto Material-UI cards. When I was testing different styling on my cards the other day I was able to make different classes and update the card appearance however I liked. However today when I added new information to my database the new cards will not take all of the styling from the Material-UI database. Specifically it seems like the new cards are not effected by justifyContent.
This is a difficult issue for me to explain but basically I have a database of information being mapped onto multiple different cards. Some of the cards are accepting the Material-UI styling other cards are not.
I would like to post a jsfiddle but I would need to link it to my database and I'm not sure that can be done.
Here is the page which is mapping my redux state:
import React, Component from 'react';
import connect from 'react-redux';
import ProjectItem from '../ProjectItem/ProjectItem'
import withRouter from 'react-router-dom'
import Header from '../Header/Header'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
bodyContent:
marginTop: 100,
)
class ProjectPage extends Component
//This calls the getProjects function on the page load
componentDidMount()
this.getProjects();
//This function dispatches an action to our index page
getProjects = () =>
console.log('running')
this.props.dispatch( type: 'GET_PROJECT')
render()
const classes = this.props
return (
<div>
<Header />
<div className= classes.bodyContent>
this.props.reduxState.projects.map((project,index) =>
return(
<ProjectItem
key = index
id = project.id
name =project.name
description = project.description
thumbnail = project.thumbnail
website = project.website
github = project.github
tag_id = project.tag_id
/>
)
)
</div>
</div>
);
export default withRouter(connect(mapReduxStateToProps)(withStyles(styles)(ProjectPage)));
And here is the page with my styling.
import React, Component from 'react';
import connect from 'react-redux';
import './ProjectItem.css'
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia'
import CardContent from '@material-ui/core/CardContent'
import Typography from '@material-ui/core/Typography'
import withStyles from '@material-ui/core';
const mapReduxStateToProps = (reduxState) => (reduxState);
const styles = theme => (
card:
display: 'flex',
width: 550,
alignSelf: 'center',
height: 150,
paddingTop: 5,
paddingBottom:5,
,
details:
display: 'flex',
flexDirection: 'column'
,
thumbnail:
height: 150,
minWidth: 150
,
contentBody:
justifyContent: 'space-between',
textAlign: 'left',
alignItems: 'center',
display : 'inline-flex',
,
toolbar: theme.mixins.toolbar
)
class ProjectItem extends Component
render()
const classes = this.props
return (
<div className='container'>
<Card className=classes.card>
<CardMedia
className=classes.thumbnail
image=this.props.thumbnail
title="Project Image"
/>
<div className=classes.details>
<CardContent className=classes.contentBody>
<Typography variant='h5'>
this.props.name
</Typography>
<Typography variant='h6'>
<a href=this.props.github>GitHub</a>
</Typography>
<Typography variant='h6'>
<a href=this.props.website>Website</a>
</Typography>
<Typography variant='h6'>
this.props.tag_id
</Typography>
</CardContent>
<CardContent className=classes.content>
<Typography>
this.props.description
</Typography>
</CardContent>
</div>
</Card>
</div>
);
export default connect(mapReduxStateToProps)(withStyles(styles)(ProjectItem));
reactjs redux material-ui
reactjs redux material-ui
asked Nov 11 at 16:05
user8735495
1419
1419
1
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Did you adddisplay : 'inline-flex'
between you tests?
– Sylvain Biehler
Nov 12 at 12:42
add a comment |
1
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Did you adddisplay : 'inline-flex'
between you tests?
– Sylvain Biehler
Nov 12 at 12:42
1
1
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Did you add
display : 'inline-flex'
between you tests?– Sylvain Biehler
Nov 12 at 12:42
Did you add
display : 'inline-flex'
between you tests?– Sylvain Biehler
Nov 12 at 12:42
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250571%2freact-material-ui-not-justify-content-will-not-work-for-all-of-my-cards%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Please create sandbox snippet, very efficiently you could receive help :) codesandbox.io
– Ajit T Stephen
Nov 11 at 18:00
Did you add
display : 'inline-flex'
between you tests?– Sylvain Biehler
Nov 12 at 12:42