Added paper to collections.

This commit is contained in:
WildScotsmen 2018-12-10 17:25:42 -05:00
parent 37eba8454a
commit d879236e67
1 changed files with 29 additions and 6 deletions

View File

@ -1,25 +1,48 @@
import React, { Component} from 'react'; import React, { Component } from 'react';
import Grid from '@material-ui/core/Grid'; import Grid from '@material-ui/core/Grid';
import FlameLinkCollectionStructure from './FlameLinkCollectionStructure'; import FlameLinkCollectionStructure from './FlameLinkCollectionStructure';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
const styles = theme => ({
root: {
...theme.mixins.gutters(),
margin: theme.spacing.unit * 2,
paddingTop: theme.spacing.unit * 2,
paddingBottom: theme.spacing.unit * 2,
width: '100%'
},
});
class FlameLinkCollectionComponentCreations extends Component { class FlameLinkCollectionComponentCreations extends Component {
createCollectionEntries(schemaData, schemaContent, arr){ createCollectionEntries(schemaData, schemaContent, arr) {
var collectionInfo = [schemaData, schemaContent]; var collectionInfo = [schemaData, schemaContent];
return arr.map(this.createCollectionComponents, collectionInfo); return arr.map(this.createCollectionComponents, collectionInfo);
} }
createCollectionComponents(num){ createCollectionComponents(num) {
return <FlameLinkCollectionStructure schemaData={this[0]} schemaContent={this[1]} field={this[0][num]} type={this[0][num].type} key={this[0][num].key} /> return (
<FlameLinkCollectionStructure schemaData={this[0]} schemaContent={this[1]} field={this[0][num]} type={this[0][num].type} key={this[0][num].key} />
);
} }
render() { render() {
return( const { classes } = this.props;
return (
<Paper className={classes.root} elevation={4}>
<Grid container> <Grid container>
{this.createCollectionEntries(this.props.schemaData, this.props.schemaContent, this.props.arr)} {this.createCollectionEntries(this.props.schemaData, this.props.schemaContent, this.props.arr)}
</Grid> </Grid>
</Paper>
); );
} }
} }
export default FlameLinkCollectionComponentCreations; FlameLinkCollectionComponentCreations.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(FlameLinkCollectionComponentCreations);