create new comp
This commit is contained in:
parent
56268d2392
commit
e361f4a2c5
18
components/ErrorScreen.js
Normal file
18
components/ErrorScreen.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import styles from "./ErrorScreen.module.css";
|
||||||
|
|
||||||
|
const ErrorScreen = ({ onFocus, onChange, onKeyDown }) => {
|
||||||
|
return (
|
||||||
|
<div className={styles.wrapper}>
|
||||||
|
<h1 className={styles.message}>City not found, try again!</h1>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className={styles.input}
|
||||||
|
onFocus={onFocus}
|
||||||
|
onChange={onChange}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ErrorScreen;
|
24
components/ErrorScreen.module.css
Normal file
24
components/ErrorScreen.module.css
Normal file
@ -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;
|
||||||
|
}
|
11
components/LoadingScreen.js
Normal file
11
components/LoadingScreen.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import styles from "./LoadingScreen.module.css";
|
||||||
|
|
||||||
|
const LoadingScreen = () => {
|
||||||
|
return (
|
||||||
|
<div className={styles.wrapper}>
|
||||||
|
<h1>Loading data...</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default LoadingScreen;
|
5
components/LoadingScreen.module.css
Normal file
5
components/LoadingScreen.module.css
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.wrapper {
|
||||||
|
max-width: 260px;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
}
|
@ -3,6 +3,8 @@ import Image from "next/image";
|
|||||||
|
|
||||||
import Metrics from "../components/Metrics";
|
import Metrics from "../components/Metrics";
|
||||||
import SwitchBox from "../components/SwitchBox";
|
import SwitchBox from "../components/SwitchBox";
|
||||||
|
import LoadingScreen from "../components/LoadingScreen";
|
||||||
|
import ErrorScreen from "../components/ErrorScreen";
|
||||||
|
|
||||||
import { convertTime, ctoF, timeToAMPM } from "../services/converters";
|
import { convertTime, ctoF, timeToAMPM } from "../services/converters";
|
||||||
import { isPM } from "../services/utils";
|
import { isPM } from "../services/utils";
|
||||||
@ -132,22 +134,13 @@ const App = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : weatherData && weatherData.message ? (
|
) : weatherData && weatherData.message ? (
|
||||||
<div className={styles.errScr}>
|
<ErrorScreen
|
||||||
<div>
|
onFocus={(e) => (e.target.value = "")}
|
||||||
<h1 style={{ marginBottom: "30px" }}>City not found, try again!</h1>
|
onChange={(e) => setInput(e.target.value)}
|
||||||
<input
|
onKeyDown={(e) => enterKeydown(e)}
|
||||||
type="text"
|
/>
|
||||||
className={styles.searchInput}
|
|
||||||
onFocus={(e) => (e.target.value = "")}
|
|
||||||
onChange={(e) => setInput(e.target.value)}
|
|
||||||
onKeyDown={(e) => enterKeydown(e)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.errScr}>
|
<LoadingScreen />
|
||||||
<h1>Loading data...</h1>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,20 +78,6 @@
|
|||||||
font-size: 18px;
|
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) {
|
@media only screen and (max-width: 950px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user