import { IonCardSubtitle, IonCol, IonIcon, IonNote, IonRow } from '@ionic/react'; import { pulseOutline, sunnyOutline, thermometerOutline } from 'ionicons/icons'; import { useEffect, useState } from 'react'; export const WeatherProperty = ({ type, currentWeather }: { type: any; currentWeather: any }) => { const [property, setProperty] = useState(false); const properties = { wind: { isIcon: false, icon: '/assets/WeatherDemo/wind.png', alt: 'wind', label: 'Wind', value: `${currentWeather.current.wind_mph}mph`, }, feelsLike: { isIcon: true, icon: thermometerOutline, alt: 'feels like', label: 'Feels like', value: `${currentWeather.current.feelslike_c}°C`, }, indexUV: { isIcon: true, icon: sunnyOutline, alt: 'index uv', label: 'Index UV', value: currentWeather.current.uv, }, pressure: { isIcon: true, icon: pulseOutline, alt: 'pressure', label: 'Pressure', value: `${currentWeather.current.pressure_mb} mbar`, }, }; useEffect(() => { setProperty(properties[type]); }, [type]); return ( {!property.isIcon && ( {property.alt} )} {property.isIcon && ( )} {property.label} {property.value} ); };