From e617de2020b54a18f207a97b91e93bf0e3c13f41 Mon Sep 17 00:00:00 2001 From: madarsbiss Date: Wed, 22 Sep 2021 16:29:40 +0300 Subject: [PATCH] add new comps --- components/ContentBox.js | 7 +++++++ components/ContentBox.module.css | 12 ++++++++++++ components/Header.js | 7 +++++++ components/Header.module.css | 12 ++++++++++++ pages/index.js | 10 ++++++---- styles/Home.module.css | 24 ------------------------ 6 files changed, 44 insertions(+), 28 deletions(-) create mode 100644 components/ContentBox.js create mode 100644 components/ContentBox.module.css create mode 100644 components/Header.js create mode 100644 components/Header.module.css diff --git a/components/ContentBox.js b/components/ContentBox.js new file mode 100644 index 0000000..a2c8e8e --- /dev/null +++ b/components/ContentBox.js @@ -0,0 +1,7 @@ +import styles from "./ContentBox.module.css"; + +const ContentBox = ({ children }) => { + return
{children}
; +}; + +export default ContentBox; diff --git a/components/ContentBox.module.css b/components/ContentBox.module.css new file mode 100644 index 0000000..31dc882 --- /dev/null +++ b/components/ContentBox.module.css @@ -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; + } +} diff --git a/components/Header.js b/components/Header.js new file mode 100644 index 0000000..22612fd --- /dev/null +++ b/components/Header.js @@ -0,0 +1,7 @@ +import styles from "./Header.module.css"; + +const Header = ({ children }) => { + return
{children}
; +}; + +export default Header; diff --git a/components/Header.module.css b/components/Header.module.css new file mode 100644 index 0000000..23bec5c --- /dev/null +++ b/components/Header.module.css @@ -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; + } +} diff --git a/pages/index.js b/pages/index.js index 921456e..fd85a39 100644 --- a/pages/index.js +++ b/pages/index.js @@ -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} /> -
-
+ +
{ e.target.placeholder = "Search a city..."; }} /> -
+ -
+ ) : weatherData && weatherData.message ? ( diff --git a/styles/Home.module.css b/styles/Home.module.css index 55df649..3702c2e 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -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; - } -}