Created
January 16, 2019 20:53
-
-
Save Gguigre/9abd7d20157115723f32dd1748c47ff1 to your computer and use it in GitHub Desktop.
Sunshine simple Overview component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render() { | |
const { maxTemperature, minTemperature, weatherType } = this.props; | |
const today = new Date(); | |
const image = getImageFromWeatherType(weatherType); | |
return ( | |
<View style={styles.container}> | |
{!!maxTemperature && !!minTemperature && !!weatherType && !!image && ( | |
<TransitionView style={styles.content}> | |
<View> | |
<Text style={[theme.typo.mediumText, styles.whiteText]}> | |
{today.toDateString()} | |
</Text> | |
<Text style={[theme.typo.veryBigText, styles.whiteText]}> | |
{`${maxTemperature}°`} | |
</Text> | |
<Text style={[theme.typo.bigText, styles.whiteText]}> | |
{`${minTemperature}°`} | |
</Text> | |
</View> | |
<View style={styles.weatherTypeContainer}> | |
<Image source={image} style={styles.weatherTypeImage} /> | |
<Text style={[theme.typo.mediumText, styles.whiteText]}> | |
{weatherType.replace(/^\w/, c => c.toUpperCase())} | |
</Text> | |
</View> | |
</TransitionView> | |
)} | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment