diff --git a/README.md b/README.md index 95d55b2..1a6ee7f 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ **๐Ÿ‘‰ ๋ฐฐํฌ ํŽ˜์ด์ง€ : https://alittlekitten.github.io/SsocoTimer/** -**์ตœ์‹  ์—…๋ฐ์ดํŠธ ๋‚ ์งœ : `2022.04.29`** +**์ตœ์‹  ์—…๋ฐ์ดํŠธ ๋‚ ์งœ : `2022.06.05`** -**์ตœ์‹  ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „ : `ver 1.6.0`** +**์ตœ์‹  ๋ฆด๋ฆฌ์ฆˆ ๋ฒ„์ „ : `ver 1.6.1`** -![Honeycam 2022-04-29 04-29-39](https://user-images.githubusercontent.com/14370441/165831202-631f382a-96a9-40f1-aaab-65316f97f678.gif) +![Honeycam 2022-06-05 01-07-53](https://user-images.githubusercontent.com/14370441/172014867-12fedd62-705a-4e09-865a-c5586d77bbd6.gif) - `React`์™€ `CRA`๋ฅผ ์ด์šฉํ•ด์„œ ๊ฐ„๋‹จํ•œ ์Šคํ†ฑ์›Œ์น˜์™€ ํƒ€์ด๋จธ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“ค์–ด๋ณด๋Š” ์—ฐ์Šต์šฉ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์ž…๋‹ˆ๋‹ค. - React์˜ ๊ธฐ๋ณธ์ ์ธ ๋™์ž‘ ๋ฐฉ์‹์„ ์ตํžˆ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. @@ -199,6 +199,14 @@ - [x] svg ์‚ฌ์ง„์— ์„ค๋ช…(alt) ์ถ”๊ฐ€ - svg ํŒŒ์ผ์— alt์†์„ฑ์„ ์ง์ ‘ ์ค„ ์ˆ˜ ์—†์–ด ์šฐํšŒ์ ์œผ๋กœ title ์ ์šฉ - [x] ํƒญ์— ๋“ค์–ด๊ฐ€๋Š” ์ด๋ฆ„์— ๋„์–ด์“ฐ๊ธฐ ์ถ”๊ฐ€ +### `22.06.05` - `v1.6.1` + +- [x] ํ™”๋ฉด์ด ์ž‘์€ ๊ฒฝ์šฐ ์Šคํฌ๋กค์ด ์ƒ๊ธฐ๋Š” ๋ถ€๋ถ„ ์ œ๊ฑฐ +- [x] ํ•ด๋‹น ์›”์— ์—†๋Š” ๋‚ ์งœ๊ฐ€ ํ™”๋ฉด์— ๋‚จ์•„์žˆ๋Š” ํ˜„์ƒ ์ œ๊ฑฐ +- [x] useDday ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์„ ๋ณ„๋„๋กœ ๋ถ„๋ฆฌ +- [x] ๋‹คํฌ๋ชจ๋“œ์ผ ๋•Œ nav๋ฐ”์— ํฐ์ƒ‰ ๊ทธ๋ฆผ์ž ์ถ”๊ฐ€ +- [x] D-day๋ถ€๋ถ„ ๊ฒฐ๊ณผ ๋ฉ”์‹œ์ง€์ฐฝ ์ปฌ๋Ÿฌ ํ•˜์ด๋ผ์ดํŒ…์œผ๋กœ ๊ฐ€๋…์„ฑ ํ–ฅ์ƒ +
## ๐Ÿ— ๊ณ ๋ฏผํ•œ ์  @@ -303,7 +311,7 @@ - ์ด ๊ณผ์ •์„ ํ†ตํ•ด ์ปดํฌ๋„ŒํŠธ๋Š” ์ถœ๋ ฅ ๋ถ€๋ถ„, ์ปค์Šคํ…€ ํ›…์€ ๋กœ์ง ๋ถ€๋ถ„์„ ๋‹ด๋‹นํ•˜๋Š” ๊ด€์‹ฌ์‚ฌ ๋ถ„๋ฆฌ๊ฐ€ ๋ณด๋‹ค ๋ช…ํ™•ํ•˜๊ฒŒ ์ด๋ฃจ์–ด์งˆ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. - ๋˜ํ•œ ์žฌ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•œ Time Management์™€ ๊ด€๋ จ๋œ ๋ถ€๋ถ„์„ ๋ณ„๋„๋กœ ์ปค์Šคํ…€ ํ›…์œผ๋กœ ๋ฝ‘์•„๋‚ด์„œ hooks ํด๋”์˜ utils ํด๋” ์•ˆ์— ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค. (์ปค์Šคํ…€ ํ›… 2๋‹จ ๋ถ„๋ฆฌ) - ๊ทธ๋ ‡๊ฒŒ ๋นผ๋‚ธ useTimeManage ์ปค์Šคํ…€ ํ›…์€ ๊ฐ๊ฐ์˜ ์ปดํฌ๋„ŒํŠธ ๋‹ด๋‹น ์ปค์Šคํ…€ ํ›…์—์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. -- ํ˜„์žฌ๊นŒ์ง€ ๊ฐ€์žฅ ํฐ 3๊ฐœ์˜ ๊ธฐ๋Šฅ๋‹จ์œ„์ธ Timer, Stopwatch, Clock์— ๋Œ€ํ•œ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋ถ„๋ฆฌ๋ฅผ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค. +- ํ˜„์žฌ๊นŒ์ง€ ๊ฐ€์žฅ ํฐ 4๊ฐœ์˜ ๊ธฐ๋Šฅ๋‹จ์œ„์ธ Timer, Stopwatch, Clock, Dday์— ๋Œ€ํ•œ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋ถ„๋ฆฌ๋ฅผ ์™„๋ฃŒํ–ˆ์Šต๋‹ˆ๋‹ค. - ๋‹ค๋งŒ ๊ฐ๊ฐ์˜ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๋‹จ์œ„๋„ ๋‹ค์†Œ ํฐ ๋ถ€๋ถ„์ด ์žˆ์–ด์„œ ์กฐ๊ธˆ ๋” ์„ธ์„ธํ•˜๊ฒŒ ๋‚˜๋ˆŒ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. - ์ถ”๊ฐ€๋กœ ์ „์—ญ store์—์„œ useSelector๋กœ ๊ฐ€์ ธ์˜ค๋Š” ์ƒํƒœ๋ฅผ ๋ž˜ํ•‘ํ•˜๋Š” ์ปค์Šคํ…€ ํ›…์„ ์ƒ์„ฑํ•ด์„œ ์‚ฌ์šฉํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค. @@ -376,6 +384,10 @@ ## ๐ŸŽž ์›€์งค +### ver 1.6.1 + +![Honeycam 2022-06-05 01-07-53](https://user-images.githubusercontent.com/14370441/172014867-12fedd62-705a-4e09-865a-c5586d77bbd6.gif) + ### ver 1.6.0 ![Honeycam 2022-04-29 04-29-39](https://user-images.githubusercontent.com/14370441/165831202-631f382a-96a9-40f1-aaab-65316f97f678.gif) diff --git a/package.json b/package.json index d9ddb30..dc079e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ssocotimer", - "version": "1.6.0", + "version": "1.6.1", "private": true, "dependencies": { "@babel/preset-react": "^7.16.7", diff --git a/src/components/Dday.tsx b/src/components/Dday.tsx index 5e4e990..17ea61f 100644 --- a/src/components/Dday.tsx +++ b/src/components/Dday.tsx @@ -1,56 +1,20 @@ import { css, useTheme } from "@emotion/react"; -import React, { useEffect, useState } from "react"; +import useDday from "@hooks/useDday"; import { ThemeVariables } from "@styles/palette"; import { Helmet } from "react-helmet-async"; const Dday = () => { - const nowTime = new Date(); - const [year, setYear] = useState(nowTime.getFullYear()); - const [month, setMonth] = useState(nowTime.getMonth() + 1); - const [day, setDay] = useState(nowTime.getDate()); - const [msg, setMsg] = useState(""); + const { + year, + month, + day, + ddayCal, + yearOnChange, + monthOnChange, + dayOnChange, + } = useDday(); const theme = useTheme() as ThemeVariables; - const yearOnChange = (e: React.ChangeEvent) => { - const nowYear = new Date().getFullYear(); - const originalValue = e.target.value; - const onlyNumber = originalValue.replace(/[^0-9]/g, ""); - if (!onlyNumber) setYear(0); - else if (+onlyNumber > 2099) setYear(nowYear); - else setYear(+onlyNumber); - }; - - const monthOnChange = (e: React.ChangeEvent) => { - const originalValue = e.target.value; - const onlyNumber = originalValue.replace(/[^0-9]/g, ""); - if (!onlyNumber) setMonth(0); - else if (+onlyNumber > 12) return; - else setMonth(+onlyNumber); - }; - - const dayOnChange = (e: React.ChangeEvent) => { - const maxDay = new Date(year, month, 0).getDate(); - const originalValue = e.target.value; - const onlyNumber = originalValue.replace(/[^0-9]/g, ""); - if (!onlyNumber) setDay(0); - else if (+onlyNumber > maxDay) return; - else setDay(+onlyNumber); - }; - - useEffect(() => { - const today = new Date(); - const dday = new Date(year, month - 1, day); - const calGetTime = today.getTime() - dday.getTime(); - const result = Math.floor(calGetTime / (1000 * 60 * 60 * 24)); - if (year < 1970 || year > 2099 || month === 0 || day === 0) { - setMsg("์œ ํšจํ•˜์ง€ ์•Š์€ ๋‚ ์งœ์ž…๋‹ˆ๋‹ค!"); - } else { - if (result === 0) setMsg(`์˜ค๋Š˜์ด ๋ฐ”๋กœ D-Day!`); - else if (result > 0) setMsg(`์˜ค๋Š˜๋กœ๋ถ€ํ„ฐ ${result}์ผ ์ง€๋‚ฌ์Šต๋‹ˆ๋‹ค!!`); - else setMsg(`์•ž์œผ๋กœ ${Math.abs(result)}์ผ ๋‚จ์•˜์Šต๋‹ˆ๋‹ค!!!`); - } - }, [year, month, day]); - return ( <> @@ -82,7 +46,21 @@ const Dday = () => {

-

{msg}

+ {ddayCal === null ? ( +

์œ ํšจํ•˜์ง€ ์•Š์€ ๋‚ ์งœ์ž…๋‹ˆ๋‹ค!

+ ) : ddayCal === 0 ? ( +

+ ์˜ค๋Š˜์ด ๋ฐ”๋กœ D-day!! +

+ ) : ddayCal > 0 ? ( +

+ ์˜ค๋Š˜๋กœ๋ถ€ํ„ฐ {ddayCal}์ผ ์ง€๋‚ฌ์Šต๋‹ˆ๋‹ค!! +

+ ) : ( +

+ ์•ž์œผ๋กœ {Math.abs(ddayCal)}์ผ ๋‚จ์•˜์Šต๋‹ˆ๋‹ค!! +

+ )}
); @@ -135,6 +113,10 @@ const resultContainer = (theme: ThemeVariables) => css` line-height: 50px; vertical-align: middle; color: ${theme.text1}; + + span { + color: ${theme.highlightText}; + } } `; diff --git a/src/components/Header.tsx b/src/components/Header.tsx index e13fca3..aba4242 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -35,7 +35,7 @@ const Header = () => { return (
- Ssoco Timer v1.6.0 + Ssoco Timer v1.6.1
diff --git a/src/components/Nav.tsx b/src/components/Nav.tsx index 60b9e55..56e393b 100644 --- a/src/components/Nav.tsx +++ b/src/components/Nav.tsx @@ -8,6 +8,9 @@ const Nav = () => { const { tap } = useSelector((state: RootState) => state.tapReducer); const dispatch = useDispatch(); // store์˜ reducer๋ฅผ ๋ถ€๋ฆ„ -> reducer๋ฅผ ํ†ตํ•ด ์ƒˆ๋กœ์šด action์„ ๋„˜๊ฒจ์คŒ์œผ๋กœ์จ state๋ฅผ ๋ณ€๊ฒฝํ•จ const theme = useTheme() as ThemeVariables; + const { themeStatus } = useSelector( + (state: RootState) => state.optionReducer + ); const onClickTimer = () => dispatch({ type: "Timer" }); const onClickStopwatch = () => dispatch({ type: "Stopwatch" }); @@ -15,7 +18,7 @@ const Nav = () => { const onClickDday = () => dispatch({ type: "Dday" }); return ( -
+