Skip to content

Commit

Permalink
FEAT :: enter치면 다음 문장으로 넘어가기
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdalswl718 committed Jul 4, 2024
1 parent 5277669 commit 34e8f64
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/pages/Home/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const Home_Layout = styled.div`
font-family: "TTLaundryGothicB";
align-items: center;
justify-content: center;
background-color: #f6f7fa;
`;

export const Home_Container = styled.div`
Expand Down
19 changes: 14 additions & 5 deletions src/pages/Typing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ const TypingPage = () => {
return [];
}
};
const handleEnterPress = () => {
setSentenceCount((prevCount) => prevCount + 1);
getNextSentence();
setInputValue("");
setStartTime(null); // 다음 문장으로 넘어갈 때 startTime 초기화
setCurrentSpeed(0); // 다음 문장으로 넘어갈 때 currentSpeed 초기화
};


const handleInputChange = (value: string) => {
setInputValue(value);
Expand Down Expand Up @@ -245,11 +253,12 @@ const TypingPage = () => {
<p>{sentence}</p>
</s.Typing_display_sentence>
<SentenceInput
sentence={sentence}
onInputChange={handleInputChange}
onEnterPress={getNextSentence}
inputValue={inputValue}
/>
sentence={sentence}
onInputChange={handleInputChange}
onEnterPress={handleEnterPress}
inputValue={inputValue}
/>

</s.Typing_section_two>
<s.Typing_section_three>
<p>NEXT: {nextSentence}</p>
Expand Down

0 comments on commit 34e8f64

Please sign in to comment.