This commit is contained in:
skidoodle 2022-04-02 23:50:59 +02:00
parent f5bd3b6857
commit 29312048df
8 changed files with 37 additions and 40 deletions

View file

@ -1,4 +1,3 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import toast, { Toaster } from 'react-hot-toast';
import copy from 'copy-to-clipboard'
@ -8,11 +7,11 @@ const Icon = ({icon, reference, copy = false} : {icon: any, reference: any, copy
{
copy ? (
<a onClick={() => doThings(reference)}>
<FontAwesomeIcon icon={icon} />
{icon}
</a>
) : (
<a href={reference} target='_blank' rel='noopener noreferrer' aria-label="Icon">
<FontAwesomeIcon icon={icon} />
{icon}
</a>
)
}

View file

@ -1,4 +1,4 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { FaClock } from 'react-icons/fa';
import { useEffect, useState } from 'react'
import styles from 'styles/Home.module.scss'
@ -14,7 +14,7 @@ const Timer = () => {
return(
<div className={styles.time}>
<p><FontAwesomeIcon icon={['fas', 'clock']} /> {date.toLocaleDateString('en-GB', { dateStyle: 'short' }) + ' • ' + date.toLocaleTimeString('en-GB', { timeStyle: 'medium', hour12: true, timeZone: 'Europe/Budapest'}).toUpperCase()}</p>
<p><FaClock /> {date.toLocaleDateString('en-GB', { dateStyle: 'short' }) + ' • ' + date.toLocaleTimeString('en-GB', { timeStyle: 'medium', hour12: true, timeZone: 'Europe/Budapest'}).toUpperCase()}</p>
</div>
)
}

View file

@ -1,25 +1,26 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
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: ['fas', 'sun'], _01n: ['fas', 'moon'],
_02d: ['fas', 'cloud-sun'], _02n: ['fas', 'cloud-moon'],
_03d: ['fas', 'cloud'], _03n: ['fas', 'cloud'],
_04d: ['fas', 'clouds'], _04n: ['fas', 'clouds'],
_09d: ['fas', 'cloud-drizzle'], _09n: ['fas', 'cloud-drizzle'],
_10d: ['fas', 'cloud-showers-heavy'], _10n: ['fas', 'cloud-showers-heavy'],
_11d: ['fas', 'cloud-bolt-sun'], _11n: ['fas', 'cloud-bolt-moon'],
_13d: ['fas', 'snow-flake'], _13n: ['fas', 'snow-flake'],
_50d: ['fas', 'cloud-fog'], _50n: ['fas', 'cloud-fog']
_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}>
<FontAwesomeIcon icon={icons[`_${weatherIcon}`]}/> <p>It&apos;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>
{icons[`_${weatherIcon}`]} <p>It&apos;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>
)
}