From 76595257e2de7f316f86dc468e7782cfc304c62d Mon Sep 17 00:00:00 2001 From: madarsbiss Date: Tue, 27 Jul 2021 16:59:28 +0300 Subject: [PATCH] edit switch ctr --- pages/index.js | 43 +++++++++++++++++++++++++++++++----------- styles/Home.module.css | 11 +++++++++++ 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/pages/index.js b/pages/index.js index 3b1aaa5..bc4704c 100644 --- a/pages/index.js +++ b/pages/index.js @@ -142,9 +142,11 @@ export default function Home() { } ,{" "} {systemUsed == "metric" - ? convertTime(weatherData.dt, weatherData.timezone)[0].split( - ":" - )[0] + ? parseInt( + convertTime(weatherData.dt, weatherData.timezone)[0].split( + ":" + )[0] + ) : timeToAMPM( convertTime(weatherData.dt, weatherData.timezone)[0] ).split(":")[0]} @@ -157,7 +159,6 @@ export default function Home() { (e.target.value = "")} onChange={(e) => setInput(e.target.value)} onKeyDown={(e) => something(e)} @@ -244,10 +245,17 @@ export default function Home() {

{systemUsed == "metric" - ? convertTime( - weatherData.sys.sunrise, - weatherData.timezone - )[0] + ? `${parseInt( + convertTime( + weatherData.sys.sunrise, + weatherData.timezone + )[0].split(":")[0] + )}:${ + convertTime( + weatherData.sys.sunrise, + weatherData.timezone + )[0].split(":")[1] + }` : timeToAMPM( convertTime( weatherData.sys.sunrise, @@ -305,9 +313,22 @@ export default function Home() {

- -

Metric System

-

Imperial System

+
+

+ Metric System +

+

+ Imperial System +

+
) : ( diff --git a/styles/Home.module.css b/styles/Home.module.css index be91276..998ce72 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -47,6 +47,7 @@ grid-template-columns: 1fr 1fr 1fr; gap: 20px; border-radius: 20px; + margin-bottom: 20px; } .statsCard { @@ -77,6 +78,16 @@ font-size: 18px; } +.switchBox { + text-align: right; +} + +.switch { + margin: 0 10px; + cursor: pointer; + display: inline; +} + @media only screen and (max-width: 950px) { .wrapper { display: grid;