diff --git a/components/ErrorScreen.js b/components/ErrorScreen.js new file mode 100644 index 0000000..1f7c5e3 --- /dev/null +++ b/components/ErrorScreen.js @@ -0,0 +1,18 @@ +import styles from "./ErrorScreen.module.css"; + +const ErrorScreen = ({ onFocus, onChange, onKeyDown }) => { + return ( +
+

City not found, try again!

+ +
+ ); +}; + +export default ErrorScreen; diff --git a/components/ErrorScreen.module.css b/components/ErrorScreen.module.css new file mode 100644 index 0000000..3b4f70b --- /dev/null +++ b/components/ErrorScreen.module.css @@ -0,0 +1,24 @@ +.wrapper { + max-width: 260px; + text-align: center; + display: grid; + place-items: center; +} + +.message { + margin-bottom: 30px; +} + +.input { + max-width: 100%; + margin-bottom: 20px; + height: 40px; + border: none; + padding: 0 10px; + color: #303030; + font-size: 20px; + text-align: right; + border-radius: 10px; + font-family: "Varela Round", sans-serif; + font-size: 18px; +} diff --git a/components/LoadingScreen.js b/components/LoadingScreen.js new file mode 100644 index 0000000..d8505db --- /dev/null +++ b/components/LoadingScreen.js @@ -0,0 +1,11 @@ +import styles from "./LoadingScreen.module.css"; + +const LoadingScreen = () => { + return ( +
+

Loading data...

+
+ ); +}; + +export default LoadingScreen; diff --git a/components/LoadingScreen.module.css b/components/LoadingScreen.module.css new file mode 100644 index 0000000..07de230 --- /dev/null +++ b/components/LoadingScreen.module.css @@ -0,0 +1,5 @@ +.wrapper { + max-width: 260px; + display: grid; + place-items: center; +} diff --git a/pages/index.js b/pages/index.js index 7ab5530..4e1ec48 100644 --- a/pages/index.js +++ b/pages/index.js @@ -3,6 +3,8 @@ import Image from "next/image"; import Metrics from "../components/Metrics"; import SwitchBox from "../components/SwitchBox"; +import LoadingScreen from "../components/LoadingScreen"; +import ErrorScreen from "../components/ErrorScreen"; import { convertTime, ctoF, timeToAMPM } from "../services/converters"; import { isPM } from "../services/utils"; @@ -132,22 +134,13 @@ const App = () => { ) : weatherData && weatherData.message ? ( -
-
-

City not found, try again!

- (e.target.value = "")} - onChange={(e) => setInput(e.target.value)} - onKeyDown={(e) => enterKeydown(e)} - /> -
-
+ (e.target.value = "")} + onChange={(e) => setInput(e.target.value)} + onKeyDown={(e) => enterKeydown(e)} + /> ) : ( -
-

Loading data...

-
+ ); }; diff --git a/styles/Home.module.css b/styles/Home.module.css index 02bdaee..f8d0986 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -78,20 +78,6 @@ font-size: 18px; } -.errScr { - text-align: center; - height: 100vh; - max-width: 300px; - display: grid; - place-items: center; - padding: 20px; - margin: 0 auto; -} - -.errSearchInput { - max-width: 100%; -} - @media only screen and (max-width: 950px) { .wrapper { display: grid;