You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.6 KiB
58 lines
1.6 KiB
import React, { useState, useSyncExternalStore } from "react";
|
|
import { View, StyleSheet, Text, Button, TouchableHighlight, Image } from "react-native";
|
|
import { City, FAVORITE_CITY_DATA, getCurrentWeather, Weather } from "../data/stub";
|
|
|
|
|
|
type VilleProps = {
|
|
weather: Weather,
|
|
fav: City
|
|
}
|
|
|
|
|
|
export function VilleCompopo(props: VilleProps){
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={{flex: 1, flexDirection: "row"}}>
|
|
<View style={styles.bothtext}>
|
|
<Text style={styles.title}>{props.weather.city.name}</Text>
|
|
<Text>{props.weather.city.latitude} - {props.weather.city.longitude}</Text>
|
|
</View>
|
|
<Text style={styles.temperature}>{props.weather.temperature}</Text>
|
|
<TouchableHighlight /*onPress={() => FAVORITE_CITY_DATA = this.city}*/>
|
|
<Image source={props.weather.city.longitude===FAVORITE_CITY_DATA.longitude && props.weather.city.latitude===FAVORITE_CITY_DATA.latitude ? require('../assets/yellowstar.png') : require('../assets/blackstar.png')} style={styles.button}/>
|
|
</TouchableHighlight>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: "darksalmon",
|
|
marginVertical: 5,
|
|
borderRadius: 15,
|
|
width: "90%",
|
|
alignSelf: 'center'
|
|
},
|
|
title: {
|
|
fontWeight: "bold",
|
|
fontSize: 18
|
|
},
|
|
bothtext: {
|
|
margin: 10
|
|
},
|
|
temperature: {
|
|
marginTop: 20,
|
|
fontSize: 18,
|
|
fontWeight: "bold"
|
|
},
|
|
button: {
|
|
height: 30,
|
|
width: 30,
|
|
marginTop: 13,
|
|
alignSelf: "flex-end",
|
|
margin: 5
|
|
}
|
|
}); |