Outsource weather icons
This commit is contained in:
		
							
								
								
									
										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
									
								
							 Submodule src/images/weather-icons added at bb80982bf1
									
								
							| @@ -55,6 +55,7 @@ | ||||
| } | ||||
|  | ||||
| #futureWeatherInfos th { | ||||
|     width: 25%; | ||||
|     text-align: center; | ||||
|     font-size: 3vh; | ||||
|     font-weight: bold; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user