Incorporating React and Material UI, my goal is to arrange 3 divs within a <Card>
<CardHeader/>
, positioning them with left, center, and right alignment as illustrated below.
The modification required is minor - I simply need to eliminate the padding and switch to display: inherit
. However, it appears that this <div>
lies between the specified style & titleStyle
for <CardHeader>
and
<CardHeader title={someElement}/>
The structure resembles:
...<div><div.myCardHeader><div><span><myTitleElement>...
https://i.stack.imgur.com/21uyj.png
Being new to React and styling, I am uncertain about how to approach this. Below is an example of the code.
Thank you for your assistance.
// @flow
import React, { Component } from 'react';
import Paper from 'material-ui/Paper';
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card';
const style = {
paper: {
height: 250,
width: 200,
margin: 20,
},
card: {
header: {
container: {
display: 'flex', /* establish flex container */
justifyContent: 'space-between',
backgroundColor: 'lightblue'
},
padding: 1,
height: 26
}
}
};
const POCardTitle = () => (
<div className="myContainer" style={style.card.header.container}>
<div style={{ width: 25, height: 26, border: '2px dashed red' }}> - </div>
<div style={{ width: 25, height: 26, border: '2px dashed blue' }}> - </div>
<div style={{ width: 25, height: 26, border: '2px dashed green' }}> - </div>
</div>
);
export default class POCard extends Component {
render() {
return (
<div>
<Paper style={style.paper} zDepth={2} >
<Card >
<CardHeader className="myCardHeader"
style={style.card.header}
titleStyle={{ paddingRight: 0, display: 'inline' }}
title={<POCardTitle />}
/>
</Card>
</Paper>
</div>
);
}
}