diff --git a/components/SwitchBox.js b/components/SwitchBox.js new file mode 100644 index 0000000..a25f9a1 --- /dev/null +++ b/components/SwitchBox.js @@ -0,0 +1,24 @@ +import styles from "./SwitchBox.module.css"; + +const SwitchBox = ({ onClick, systemUsed }) => { + return ( +
+

+ Metric System +

+

+ Imperial System +

+
+ ); +}; + +export default SwitchBox; diff --git a/components/SwitchBox.module.css b/components/SwitchBox.module.css new file mode 100644 index 0000000..846ed9f --- /dev/null +++ b/components/SwitchBox.module.css @@ -0,0 +1,9 @@ +.wrapper { + text-align: right; +} + +.switch { + margin: 0 10px; + cursor: pointer; + display: inline; +} diff --git a/pages/index.js b/pages/index.js index d05a86d..7ab5530 100644 --- a/pages/index.js +++ b/pages/index.js @@ -2,6 +2,8 @@ import { useState, useEffect } from "react"; import Image from "next/image"; import Metrics from "../components/Metrics"; +import SwitchBox from "../components/SwitchBox"; + import { convertTime, ctoF, timeToAMPM } from "../services/converters"; import { isPM } from "../services/utils"; @@ -126,22 +128,7 @@ const App = () => { -
-

- Metric System -

-

- Imperial System -

-
+ ) : weatherData && weatherData.message ? ( diff --git a/styles/Home.module.css b/styles/Home.module.css index cf508f2..02bdaee 100644 --- a/styles/Home.module.css +++ b/styles/Home.module.css @@ -78,16 +78,6 @@ font-size: 18px; } -.switchBox { - text-align: right; -} - -.switch { - margin: 0 10px; - cursor: pointer; - display: inline; -} - .errScr { text-align: center; height: 100vh;