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));









share|improve this question

















  • 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














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));









share|improve this question

















  • 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












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));









share|improve this question













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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 add display : 'inline-flex' between you tests?
    – Sylvain Biehler
    Nov 12 at 12:42












  • 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







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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto