-
Notifications
You must be signed in to change notification settings - Fork 61
/
index.js
56 lines (50 loc) · 1.27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React, { useEffect, useContext } from "react";
import styles from "./styles.css";
import { AppContext } from "~/AppContext";
import WeatherMap from "~/components/WeatherMap";
import InfoPanel from "~/components/InfoPanel";
import Settings from "~/components/Settings";
import "!style-loader!css-loader!./overrides.css";
/**
* Main component
*
* @returns {JSX.Element} Main component
*/
const App = () => {
const {
getBrowserGeo,
getCustomLatLon,
loadStoredData,
darkMode,
mouseHide,
} = useContext(AppContext);
useEffect(() => {
getCustomLatLon();
getBrowserGeo();
loadStoredData();
}, []);
return (
<div
className={`${darkMode ? styles.dark : styles.light} ${
mouseHide ? styles.hideMouse : ""
}`}
>
<div className={styles.container}>
<div className={styles.settingsContainer}>
<Settings />
</div>
<div
className={`${styles.weatherMap} map-container ${
mouseHide ? "map-mouse-hide" : ""
} ${darkMode ? "map-dark-mode" : ""}`}
>
<WeatherMap zoom={9} dark={darkMode} />
</div>
<div className={styles.infoContainer}>
<InfoPanel />
</div>
</div>
</div>
);
};
export default App;