Skip to content

Commit

Permalink
Add ability to set full width for card
Browse files Browse the repository at this point in the history
  • Loading branch information
xotahal committed Apr 14, 2016
1 parent 495fb79 commit 2c04e40
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const styles = {
container: {
backgroundColor: '#ffffff',
borderRadius: 2,
margin: 8,
marginVertical: 8,
marginHorizontal: 8,
paddingLeft: 16,
paddingRight: 16
}
Expand All @@ -27,6 +28,7 @@ export default class Card extends Component {
rippleColor: PropTypes.string
}),
elevation: PropTypes.number,
fullWidth: PropTypes.bool,
disabled: PropTypes.bool,
onPress: PropTypes.func,
children: PropTypes.node.isRequired,
Expand All @@ -45,11 +47,22 @@ export default class Card extends Component {
static Actions = Actions;

render() {
const { theme, overrides, elevation, disabled, onPress, children, style } = this.props;
const {
theme,
overrides,
elevation,
fullWidth,
disabled,
onPress,
children,
style
} = this.props;

const cardStyle = (() => ([
styles.container, {
elevation
}, fullWidth && {
marginHorizontal: 0
}, !isCompatible('elevation') && {
borderWidth: 1,
borderColor: 'rgba(0,0,0,.12)'
Expand Down

0 comments on commit 2c04e40

Please sign in to comment.