Skip to content

Commit 2a184d4

Browse files
RahavLussatoRahav lussato
authored andcommitted
[Card] add containerStyle prop
add containerStyle prop to have the ability to customize inner div styles. i needed this to give the div width of 100% then i can align the header to center and the body to left. Update Card.js Update Card.js Update Card.js rename childrenStyle to containerStyle Update Card.js [Card] add containerStyle prop
1 parent eb9bfc0 commit 2a184d4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Card/Card.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ class Card extends Component {
1212
* Can be used to render elements inside the Card.
1313
*/
1414
children: PropTypes.node,
15+
/**
16+
* Override the inline-styles of the container element.
17+
*/
18+
containerStyle: PropTypes.object,
1519
/**
1620
* If true, this card component is expandable. Can be set on any child of the `Card` component.
1721
*/
@@ -111,16 +115,20 @@ class Card extends Component {
111115
lastElement.type.muiName === 'CardTitle'));
112116
const {
113117
style,
118+
containerStyle,
114119
...other,
115120
} = this.props;
116121

117122
const mergedStyles = Object.assign({
118123
zIndex: 1,
119124
}, style);
125+
const containerMergedStyles = Object.assign({
126+
paddingBottom: addBottomPadding ? 8 : 0,
127+
}, containerStyle);
120128

121129
return (
122130
<Paper {...other} style={mergedStyles}>
123-
<div style={{paddingBottom: addBottomPadding ? 8 : 0}}>
131+
<div style={containerMergedStyles}>
124132
{newChildren}
125133
</div>
126134
</Paper>

0 commit comments

Comments
 (0)