mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
commit
This commit is contained in:
commit
b9dc57578a
26 changed files with 2590 additions and 0 deletions
28
components/Weather.tsx
Normal file
28
components/Weather.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import styles from 'styles/Home.module.scss'
|
||||
import { FaSun, FaMoon, FaCloudSun, FaCloudMoon, FaCloud, FaCloudShowersHeavy } from 'react-icons/fa'
|
||||
import { BsCloudDrizzleFill, BsCloudsFill, BsCloudLightningFill, BsCloudSnowFill, BsCloudFogFill } from 'react-icons/bs'
|
||||
|
||||
const Weather = ({data}: {data: any}) => {
|
||||
const { temp: temperature } = data.main
|
||||
const { icon: weatherIcon, description: weatherDescription} = data.weather[0]
|
||||
|
||||
const icons: any = {
|
||||
_01d: <FaSun />, _01n: <FaMoon />,
|
||||
_02d: <FaCloudSun />, _02n: <FaCloudMoon />,
|
||||
_03d: <FaCloud />, _03n: <FaCloud />,
|
||||
_04d: <BsCloudsFill />, _04n: <BsCloudsFill />,
|
||||
_09d: <BsCloudDrizzleFill />, _09n: <BsCloudDrizzleFill />,
|
||||
_10d: <FaCloudShowersHeavy />, _10n: <FaCloudShowersHeavy />,
|
||||
_11d: <BsCloudLightningFill />, _11n: <BsCloudLightningFill />,
|
||||
_13d: <BsCloudSnowFill />, _13n: <BsCloudSnowFill />,
|
||||
_50d: <BsCloudFogFill />, _50n: <BsCloudFogFill />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.weather}>
|
||||
{icons[`_${weatherIcon}`]} <p>It's currently <b>{parseInt(temperature)} °C</b> <span>({weatherDescription})</span> in <a href='https://weather.com/en-GB/weather/today/l/b979f874d2f515646f37e2bb434a85cc04869c5a35c6bdf1c6fba26f659313f0' target="_blank" rel='noopener noreferrer'><b>Budapest</b></a></p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Weather
|
Loading…
Add table
Add a link
Reference in a new issue