Skip to content

Commit be0a00a

Browse files
authored
Merge pull request #1 from alanb4rt/migration/ts
migration: js -> ts
2 parents 1fe5f98 + ed3214d commit be0a00a

20 files changed

+1519
-3734
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<body>
1212
<div id="root"></div>
13-
<script type="module" src="/src/main.jsx"></script>
13+
<script type="module" src="/src/main.tsx"></script>
1414
</body>
1515

1616
</html>

package-lock.json

Lines changed: 1396 additions & 3687 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,28 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "vite build",
8+
"build": "tsc -b && vite build",
99
"lint": "eslint .",
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"react": "^18.3.1",
14-
"react-dom": "^18.3.1"
13+
"react": "^19.0.0",
14+
"react-dom": "^19.0.0"
1515
},
1616
"devDependencies": {
17-
"@eslint/js": "^9.9.0",
18-
"@types/react": "^18.3.3",
19-
"@types/react-dom": "^18.3.0",
20-
"@vitejs/plugin-react": "^4.3.1",
17+
"@eslint/js": "^9.19.0",
18+
"@types/react": "^19.0.8",
19+
"@types/react-dom": "^19.0.3",
20+
"@vitejs/plugin-react": "^4.3.4",
2121
"autoprefixer": "^10.4.20",
22-
"eslint": "^9.9.0",
23-
"eslint-plugin-react": "^7.35.0",
24-
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
25-
"eslint-plugin-react-refresh": "^0.4.9",
26-
"globals": "^15.9.0",
22+
"eslint": "^9.19.0",
23+
"eslint-plugin-react-hooks": "^5.0.0",
24+
"eslint-plugin-react-refresh": "^0.4.18",
25+
"globals": "^15.14.0",
26+
"typescript": "~5.7.2",
27+
"typescript-eslint": "^8.22.0",
2728
"postcss": "^8.4.47",
2829
"tailwindcss": "^3.4.13",
2930
"vite": "^5.4.1"
3031
}
31-
}
32+
}
File renamed without changes.
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
11
import { useEffect, useState } from "react";
2+
import { checkValue } from "../utils/checkValue";
3+
import { CountdownType } from "../types/countdown";
24

3-
export default function CountdownCard({ value, unit }) {
5+
export default function CountdownCard({ value, unit }: CountdownType) {
46
const [isAnimating, setIsAnimating] = useState(true);
57

68
useEffect(() => {
79
setIsAnimating(true);
810
setTimeout(() => setIsAnimating(false), 1000 - 50);
911
}, [value]);
1012

11-
const checkValue = (value) => {
12-
switch (unit) {
13-
case "seconds":
14-
case "minutes":
15-
return value === 59 ? 0 : value + 1;
16-
case "hours":
17-
return value === 23 ? 0 : value + 1;
18-
default:
19-
return value + 1;
20-
}
21-
};
22-
2313
return (
2414
<div className="flex flex-col gap-4 md:gap-8 text-center">
2515
<div className="card rounded md:rounded-lg pb-3">
@@ -33,15 +23,15 @@ export default function CountdownCard({ value, unit }) {
3323
isAnimating ? "animate-card-top" : ""
3424
}`}
3525
>
36-
<div className="card-top-content">{checkValue(value)}</div>
26+
<div className="card-top-content">{checkValue(value, unit)}</div>
3727
</div>
3828
)}
3929
</div>
4030

4131
<div className="ctn-card-bottom rounded md:rounded-lg">
4232
<div className="card-bottom rounded md:rounded-lg">
4333
<div className="card-bottom-content">
44-
{isAnimating ? checkValue(value) : value}
34+
{isAnimating ? checkValue(value, unit) : value}
4535
</div>
4636
</div>
4737
{isAnimating && (

0 commit comments

Comments
 (0)