diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dde92bd..d036e09 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,3 +2,4 @@ 1. zetabug 2. AnthonyHad +3. Consci210 diff --git a/src/App.js b/src/App.js index 99bd8f3..24705ed 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,10 @@ import React, { useCallback } from 'react'; import { useState, useEffect } from 'react'; - import Weather from './components/Weather'; import LoadingIndicator from './UI/LoadingIndicator'; - import './app.css'; +import sunImage from "./images/sun.png" +import moonImage from "./images/moon.jpg" function App() { const [data, setData] = useState(null); @@ -13,6 +13,27 @@ function App() { const [location, setLocation] = useState(''); const [isLoading, setIsLoading] = useState(false); + // Added light and dark mode toggler here + + const [mode, setMode] = useState("light"); + + useEffect(() => { + + if (mode === "light") { + document.documentElement.style.setProperty("--bg-color", "#fff"); + document.documentElement.style.setProperty("--text-color", "#333"); + } else { + document.documentElement.style.setProperty("--bg-color", "#333"); + document.documentElement.style.setProperty("--text-color", "#fff"); + } + }, [mode]); + + const toggleMode = () => { + setMode(mode === "light" ? "dark" : "light"); + }; + + // added code ends here + function handleSearch(e) { setSearch(e.target.value); } @@ -58,30 +79,44 @@ function App() {

no data found 😬

); + + return ( <> -
-

WEATHER APPLICATION

-
- -
-
-

or

-
-
- -
-
-
- {isLoading && } - {display} +
+ {/* Added toggle container element here */} +
+ +
+

WEATHER APPLICATION

+
+ +
+
+

or

+
+
+
- Ranvir@zetabug/github +
+
+ {isLoading && } + {display} + +
+ {/* Added a github icon svg */} + ); } diff --git a/src/app.css b/src/app.css index e437085..6fee444 100644 --- a/src/app.css +++ b/src/app.css @@ -50,3 +50,69 @@ button { font-family: 'Courier New', Courier, monospace; font-weight: bold; } + +/* Added styling here */ + +/* Light Mode */ +.container { + background-color: #f1f1f1; + color: #333; +} + +.toggle-container { + text-align: center; + position: fixed; + left: 5px; + margin: 1rem; +} +.toggle-container img{ + width: 20px; + height: 20px; + border-radius: 50%; +} +button { + background-color: #333; + border: none; + color: #fff; + cursor: pointer; + padding: 8px 16px; +} +.light-btn{ + background-color: inherit; +} + +/* Dark Mode */ +.container.dark { + background-color: #333; + color: #f1f1f1; +} + +.container.dark h1 { + color: #fff; +} + +.container.dark .search-sec input { + background-color: #f1f1f1; + color: #333; +} + +.toggle-container .button { + background-color: #fff; + color: #333; +} + +.toggle-container .button:hover { + background-color: #f1f1f1; +} + +button { + background-color: #fcfcfc; + color: black; + cursor: pointer; + padding: 8px 16px; +} +button:hover { + background-color: white ; + color: #333; + box-shadow: rgb(45, 45, 43) 2px 2px; +} \ No newline at end of file diff --git a/src/images/moon.jpg b/src/images/moon.jpg new file mode 100644 index 0000000..da8eda8 Binary files /dev/null and b/src/images/moon.jpg differ diff --git a/src/images/sun.png b/src/images/sun.png new file mode 100644 index 0000000..a964bca Binary files /dev/null and b/src/images/sun.png differ