add search comp
This commit is contained in:
parent
9b359bd358
commit
e4dcd3183b
17
components/Search.js
Normal file
17
components/Search.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import styles from "./Search.module.css";
|
||||||
|
|
||||||
|
const Search = ({ placeHolder, value, onFocus, onChange, onKeyDown }) => {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
className={styles.searchInput}
|
||||||
|
type="text"
|
||||||
|
placeholder={placeHolder}
|
||||||
|
value={value}
|
||||||
|
onFocus={onFocus}
|
||||||
|
onChange={onChange}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Search;
|
18
components/Search.module.css
Normal file
18
components/Search.module.css
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
.searchInput {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width: 520px) {
|
||||||
|
.searchInput {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ import { useState, useEffect } from "react";
|
|||||||
|
|
||||||
import MainCard from "../components/MainCard";
|
import MainCard from "../components/MainCard";
|
||||||
import Dates from "../components/Dates";
|
import Dates from "../components/Dates";
|
||||||
|
import Search from "../components/Search";
|
||||||
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 LoadingScreen from "../components/LoadingScreen";
|
||||||
@ -51,14 +52,11 @@ const App = () => {
|
|||||||
systemUsed={systemUsed}
|
systemUsed={systemUsed}
|
||||||
weatherData={weatherData}
|
weatherData={weatherData}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={styles.statsWrapper}>
|
<div className={styles.statsWrapper}>
|
||||||
<div className={styles.titleAndSearch}>
|
<div className={styles.titleAndSearch}>
|
||||||
<Dates weatherData={weatherData} systemUsed={systemUsed} />
|
<Dates weatherData={weatherData} systemUsed={systemUsed} />
|
||||||
<input
|
<Search
|
||||||
type="text"
|
placeHolder="Search a city..."
|
||||||
className={styles.searchInput}
|
|
||||||
placeholder="Search a city..."
|
|
||||||
value={input}
|
value={input}
|
||||||
onFocus={(e) => {
|
onFocus={(e) => {
|
||||||
e.target.value = "";
|
e.target.value = "";
|
||||||
@ -71,7 +69,6 @@ const App = () => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Metrics data={weatherData} systemUsed={systemUsed} />
|
<Metrics data={weatherData} systemUsed={systemUsed} />
|
||||||
<SwitchBox onClick={changeSystem} systemUsed={systemUsed} />
|
<SwitchBox onClick={changeSystem} systemUsed={systemUsed} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -11,10 +11,6 @@
|
|||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wrapperHide {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statsWrapper {
|
.statsWrapper {
|
||||||
background-color: rgb(247, 247, 247);
|
background-color: rgb(247, 247, 247);
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
@ -28,19 +24,6 @@
|
|||||||
gap: 20px;
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.searchInput {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media only screen and (max-width: 950px) {
|
@media only screen and (max-width: 950px) {
|
||||||
.wrapper {
|
.wrapper {
|
||||||
display: grid;
|
display: grid;
|
||||||
@ -66,8 +49,4 @@
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
place-items: center;
|
place-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.searchInput {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user