-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
todoList, 프로필페이지, 메인 페이지 오류 수정
- Loading branch information
Showing
13 changed files
with
139 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
.../(root)/[workspaceId]/to-do-list/(providers)/add/[id]/_components/TimeInput/TimeInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import Typography from '@/components/Typography'; | ||
import ChevronDownIcon from '@/icons/ChevronDown.svg'; | ||
import ChevronUpIcon from '@/icons/ChevronUpIcon.svg'; | ||
|
||
interface TimeInputProps { | ||
handleUp: () => void; | ||
handleDown: () => void; | ||
checkStr: (time: number) => void; | ||
time: number; | ||
} | ||
|
||
const TimeInput = ({ handleUp, handleDown, checkStr, time }: TimeInputProps) => { | ||
return ( | ||
<div className="flex flex-col items-center gap-2"> | ||
<button onClick={handleUp}> | ||
<ChevronUpIcon /> | ||
</button> | ||
<Typography variant="Title22px" color="grey900"> | ||
<div className="flex items-center justify-center w-[71px] h-[71px] bg-[#FAFAFA] rounded-[6px]"> | ||
<input | ||
className="w-10 text-center bg-[#FAFAFA] appearance-none" | ||
type="text" | ||
inputMode="numeric" | ||
value={time} | ||
pattern="[0-9]*" | ||
onChange={(e) => checkStr(Number(e.target.value))} | ||
/> | ||
</div> | ||
</Typography> | ||
<button onClick={handleDown}> | ||
<ChevronDownIcon /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TimeInput; |
1 change: 1 addition & 0 deletions
1
...ders)/(root)/[workspaceId]/to-do-list/(providers)/add/[id]/_components/TimeInput/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './TimeInput'; |
71 changes: 71 additions & 0 deletions
71
src/app/(providers)/(root)/[workspaceId]/to-do-list/(providers)/add/[id]/_hooks/useTime.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { useState } from 'react'; | ||
|
||
const useTime = (initIsAm: boolean, initHour: number, initMinute: number) => { | ||
const [isAm, setIsAm] = useState(initIsAm); | ||
const [hour, setHour] = useState(initHour); | ||
const [minute, setMinute] = useState(initMinute); | ||
const regHour = /^([0-9]|1[0-2])$/; | ||
const regMinute = /^([0-5][0-9]|[0-9])$/; | ||
|
||
const checkHourStr = (hour: number) => { | ||
if (regHour.test(String(hour))) setHour(hour); | ||
}; | ||
|
||
const checkMinuteStr = (minute: number) => { | ||
if (regMinute.test(String(minute))) setMinute(minute); | ||
}; | ||
|
||
const handleAM = () => { | ||
setIsAm(true); | ||
}; | ||
|
||
const handlePM = () => { | ||
setIsAm(false); | ||
}; | ||
|
||
const handleHourUp = () => { | ||
if (hour >= 12) { | ||
setHour(1); | ||
} else { | ||
if (regHour.test(String(hour))) setHour((prevHour) => prevHour + 1); | ||
} | ||
}; | ||
|
||
const handleHourDown = () => { | ||
if (hour <= 1) { | ||
setHour(12); | ||
} else { | ||
if (regHour.test(String(hour))) setHour((prevHour) => prevHour - 1); | ||
} | ||
}; | ||
const handleMinuteUp = () => { | ||
if (minute >= 59) { | ||
setMinute(0); | ||
} else { | ||
if (regMinute.test(String(minute))) setMinute((prevMinute) => prevMinute + 1); | ||
} | ||
}; | ||
const handleMinuteDown = () => { | ||
if (minute <= 0) { | ||
setMinute(59); | ||
} else { | ||
if (regMinute.test(String(minute))) setMinute((prevMinute) => prevMinute - 1); | ||
} | ||
}; | ||
|
||
return { | ||
isAm, | ||
hour, | ||
minute, | ||
checkHourStr, | ||
checkMinuteStr, | ||
handleAM, | ||
handlePM, | ||
handleHourUp, | ||
handleHourDown, | ||
handleMinuteUp, | ||
handleMinuteDown | ||
}; | ||
}; | ||
|
||
export default useTime; |
4 changes: 1 addition & 3 deletions
4
src/app/(providers)/(root)/[workspaceId]/to-do-list/(providers)/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
import ModalProvider from '@/providers/ModalProvider'; | ||
|
||
function TodoListProvidersLayout({ children }: { children: React.ReactNode }) { | ||
return <ModalProvider>{children}</ModalProvider>; | ||
return <>{children}</>; | ||
} | ||
|
||
export default TodoListProvidersLayout; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.