edit error scr
This commit is contained in:
parent
e4dcd3183b
commit
729f98f68f
@ -1,16 +1,10 @@
|
|||||||
import styles from "./ErrorScreen.module.css";
|
import styles from "./ErrorScreen.module.css";
|
||||||
|
|
||||||
const ErrorScreen = ({ onFocus, onChange, onKeyDown }) => {
|
const ErrorScreen = ({ errorMessage, children }) => {
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<h1 className={styles.message}>City not found, try again!</h1>
|
<h1 className={styles.message}>{errorMessage}</h1>
|
||||||
<input
|
{children}
|
||||||
type="text"
|
|
||||||
className={styles.input}
|
|
||||||
onFocus={onFocus}
|
|
||||||
onChange={onChange}
|
|
||||||
onKeyDown={onKeyDown}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -8,17 +8,3 @@
|
|||||||
.message {
|
.message {
|
||||||
margin-bottom: 30px;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import styles from "./LoadingScreen.module.css";
|
import styles from "./LoadingScreen.module.css";
|
||||||
|
|
||||||
const LoadingScreen = () => {
|
const LoadingScreen = ({ loadingMessage }) => {
|
||||||
return (
|
return (
|
||||||
<div className={styles.wrapper}>
|
<div className={styles.wrapper}>
|
||||||
<h1>Loading data...</h1>
|
<h1>{loadingMessage}</h1>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -74,13 +74,15 @@ const App = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : weatherData && weatherData.message ? (
|
) : weatherData && weatherData.message ? (
|
||||||
<ErrorScreen
|
<ErrorScreen errorMessage="City not found, try again!">
|
||||||
onFocus={(e) => (e.target.value = "")}
|
<Search
|
||||||
onChange={(e) => setInput(e.target.value)}
|
onFocus={(e) => (e.target.value = "")}
|
||||||
onKeyDown={(e) => enterKeydown(e)}
|
onChange={(e) => setInput(e.target.value)}
|
||||||
/>
|
onKeyDown={(e) => enterKeydown(e)}
|
||||||
|
/>
|
||||||
|
</ErrorScreen>
|
||||||
) : (
|
) : (
|
||||||
<LoadingScreen />
|
<LoadingScreen loadingMessage="Loading data..." />
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user