diff --git a/src/App.css b/src/App.css index 27551fc..b72a905 100644 --- a/src/App.css +++ b/src/App.css @@ -58,21 +58,24 @@ button:active { } .settings { - min-width: 50%; display: flex; justify-content: space-between; align-items: center; + gap: 1rem; } -.Today, -.Reset { +.vertical { + flex-direction: column; +} + +.count { + font-size: inherit; + text-align: center; + width: 10rem; +} + +.Today { font-size: 1.8rem; width: auto; padding: 0 1rem; } - -.Group { - display: flex; - flex-direction: column; - gap: 0.4rem; -} diff --git a/src/App.js b/src/App.js index 670d3b0..1c17a67 100644 --- a/src/App.js +++ b/src/App.js @@ -9,26 +9,22 @@ export default function App() {
-
- - -
+ {count !== 0 && }
); } function Step({ step, setStep }) { return ( -
- +
Step: {step} - + setStep(Number(e.target.value))} + />
); } @@ -40,12 +36,22 @@ function Counter({ step, count, setCount }) { <>
- Count: {count} + + Count:{" "} + setCount(Number(e.target.value))} + /> +

- {count === 0 + {isNaN(count) + ? "Input Error" + : count === 0 ? "Today is " : count > 0 ? count === 1 @@ -55,7 +61,9 @@ function Counter({ step, count, setCount }) { ? `${Math.abs(count)} day ago was ` : `${Math.abs(count)} days ago was `} - {date.toDateString()} + + {date.toDateString() === "Invalid Date" ? "" : date.toDateString()} +

); @@ -73,16 +81,3 @@ function Today({ setCount }) { ); } - -function Reset({ setStep }) { - return ( - - ); -}