Skip to content

Instantly share code, notes, and snippets.

@Gguigre
Created January 16, 2019 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gguigre/9abd7d20157115723f32dd1748c47ff1 to your computer and use it in GitHub Desktop.
Save Gguigre/9abd7d20157115723f32dd1748c47ff1 to your computer and use it in GitHub Desktop.
Sunshine simple Overview component
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