add new comps
This commit is contained in:
parent
54e96a608b
commit
e617de2020
7
components/ContentBox.js
Normal file
7
components/ContentBox.js
Normal file
@ -0,0 +1,7 @@
|
||||
import styles from "./ContentBox.module.css";
|
||||
|
||||
const ContentBox = ({ children }) => {
|
||||
return <div className={styles.statsWrapper}>{children}</div>;
|
||||
};
|
||||
|
||||
export default ContentBox;
|
12
components/ContentBox.module.css
Normal file
12
components/ContentBox.module.css
Normal file
@ -0,0 +1,12 @@
|
||||
.statsWrapper {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 30px;
|
||||
text-align: right;
|
||||
border-radius: 0 30px 30px 0;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 950px) {
|
||||
.statsWrapper {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
7
components/Header.js
Normal file
7
components/Header.js
Normal file
@ -0,0 +1,7 @@
|
||||
import styles from "./Header.module.css";
|
||||
|
||||
const Header = ({ children }) => {
|
||||
return <div className={styles.titleAndSearch}>{children}</div>;
|
||||
};
|
||||
|
||||
export default Header;
|
12
components/Header.module.css
Normal file
12
components/Header.module.css
Normal file
@ -0,0 +1,12 @@
|
||||
.titleAndSearch {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 520px) {
|
||||
.titleAndSearch {
|
||||
grid-template-columns: 1fr;
|
||||
place-items: center;
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import MainCard from "../components/MainCard";
|
||||
import ContentBox from "../components/ContentBox";
|
||||
import Header from "../components/Header";
|
||||
import Dates from "../components/Dates";
|
||||
import Search from "../components/Search";
|
||||
import Metrics from "../components/Metrics";
|
||||
@ -52,8 +54,8 @@ const App = () => {
|
||||
systemUsed={systemUsed}
|
||||
weatherData={weatherData}
|
||||
/>
|
||||
<div className={styles.statsWrapper}>
|
||||
<div className={styles.titleAndSearch}>
|
||||
<ContentBox>
|
||||
<Header>
|
||||
<Dates weatherData={weatherData} systemUsed={systemUsed} />
|
||||
<Search
|
||||
placeHolder="Search a city..."
|
||||
@ -68,10 +70,10 @@ const App = () => {
|
||||
e.target.placeholder = "Search a city...";
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Header>
|
||||
<Metrics data={weatherData} systemUsed={systemUsed} />
|
||||
<SwitchBox onClick={changeSystem} systemUsed={systemUsed} />
|
||||
</div>
|
||||
</ContentBox>
|
||||
</div>
|
||||
) : weatherData && weatherData.message ? (
|
||||
<ErrorScreen errorMessage="City not found, try again!">
|
||||
|
@ -11,19 +11,6 @@
|
||||
margin: 0 20px;
|
||||
}
|
||||
|
||||
.statsWrapper {
|
||||
background-color: rgb(247, 247, 247);
|
||||
padding: 30px;
|
||||
text-align: right;
|
||||
border-radius: 0 30px 30px 0;
|
||||
}
|
||||
|
||||
.titleAndSearch {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 950px) {
|
||||
.wrapper {
|
||||
display: grid;
|
||||
@ -31,10 +18,6 @@
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
.statsWrapper {
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 600px) {
|
||||
@ -43,10 +26,3 @@
|
||||
border-radius: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 520px) {
|
||||
.titleAndSearch {
|
||||
grid-template-columns: 1fr;
|
||||
place-items: center;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user