Skip to content

Commit

Permalink
Update Card component to allow overriding styles
Browse files Browse the repository at this point in the history
List of changes:
 - Update Card component to allow overriding styles for all views
 - Update StoriesTest snapshot to reflect Card component changes
  • Loading branch information
chico committed Feb 13, 2019
1 parent 9b74850 commit 83086cd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
10 changes: 5 additions & 5 deletions App/Components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ export default class Card extends Component {
onPress: PropTypes.func
}
render () {
const {image, title, text, button, onPress = () => {}} = this.props
const {image, title, text, button, onPress = () => {}, styles = {}} = this.props
return (
<View>
{image && (
<View style={s.imageView}>
<View style={[s.imageView, styles.imageView]}>
<Image source={image} />
</View>
)}
{title && (
<View style={[s.titleView]}>
<View style={[s.titleView, styles.titleView]}>
<Text style={s.title}>{title}</Text>
</View>
)}
{text && (
<View style={[s.textView]}>
<View style={[s.textView, styles.textView]}>
<Text style={s.text}>{text}</Text>
</View>
)}
{button && (
<Button containerStyle={s.centered} text={button} onPress={onPress} />
<Button containerStyle={[s.centered, styles.buttonView]} text={button} onPress={onPress} />
)}
</View>
)
Expand Down
34 changes: 21 additions & 13 deletions Tests/Components/__snapshots__/StoriesTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,16 @@ exports[`Storyshots Card Hello 1`] = `
<View>
<View
style={
Object {
"alignItems": "center",
"display": "flex",
"justifyContent": "center",
"marginVertical": 16,
"width": "100%",
}
Array [
Object {
"alignItems": "center",
"display": "flex",
"justifyContent": "center",
"marginVertical": 16,
"width": "100%",
},
undefined,
]
}
>
<Image
Expand All @@ -396,6 +399,7 @@ exports[`Storyshots Card Hello 1`] = `
"marginTop": 24,
"width": "100%",
},
undefined,
]
}
>
Expand Down Expand Up @@ -425,6 +429,7 @@ exports[`Storyshots Card Hello 1`] = `
"marginTop": 8,
"width": "100%",
},
undefined,
]
}
>
Expand All @@ -447,12 +452,15 @@ exports[`Storyshots Card Hello 1`] = `
</View>
<View
style={
Object {
"alignItems": "center",
"display": "flex",
"justifyContent": "center",
"width": "100%",
}
Array [
Object {
"alignItems": "center",
"display": "flex",
"justifyContent": "center",
"width": "100%",
},
undefined,
]
}
>
<View
Expand Down

0 comments on commit 83086cd

Please sign in to comment.