Outsource weather icons
This commit is contained in:
parent
11f1807ae9
commit
90372e12e0
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "src/images/weather-icons"]
|
||||
path = src/images/weather-icons
|
||||
url = git@github.com:erikflowers/weather-icons.git
|
@ -9,7 +9,7 @@ module.exports = {
|
||||
resolve: "gatsby-plugin-react-svg",
|
||||
options: {
|
||||
rule: {
|
||||
include: /weather/
|
||||
include: /svg/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,27 @@ import * as styles from "../styles/containers/WeatherAndTime.module.css";
|
||||
const WEATHER_REFRESH_INTERVAL = 15 * 60 * 1000;
|
||||
|
||||
function getWeatherIcon(icon: string) {
|
||||
const ImportedIcon = require(`../images/weather/${icon}.svg`);
|
||||
//const isNight = document.querySelector(':root[data-theme="night"]') !== null
|
||||
let weatherIcon: string;
|
||||
switch (icon) {
|
||||
case "clear-day":
|
||||
weatherIcon = "day-sunny"
|
||||
break
|
||||
case "clear-night":
|
||||
weatherIcon = "night-clear"
|
||||
break
|
||||
case "wind":
|
||||
weatherIcon = "windy"
|
||||
break
|
||||
case "partly-cloudy-day":
|
||||
weatherIcon = "day-cloudy"
|
||||
break
|
||||
case "partly-cloudy-night":
|
||||
weatherIcon = "night-cloudy"
|
||||
break;
|
||||
default: weatherIcon = icon
|
||||
}
|
||||
const ImportedIcon = require(`../images/weather-icons/svg/wi-${weatherIcon}.svg`);
|
||||
return <ImportedIcon />
|
||||
}
|
||||
|
||||
|
1
src/images/weather-icons
Submodule
1
src/images/weather-icons
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit bb80982bf1f43f2d57f9dd753e7413bf88beb9ed
|
@ -55,6 +55,7 @@
|
||||
}
|
||||
|
||||
#futureWeatherInfos th {
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
font-size: 3vh;
|
||||
font-weight: bold;
|
||||
|
Loading…
Reference in New Issue
Block a user