-
Notifications
You must be signed in to change notification settings - Fork 0
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
[FEAT] 학습하기 메인 탭 구현
- Loading branch information
Showing
16 changed files
with
249 additions
and
56 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { getLearnedTales } from "@apis/home"; | ||
import { | ||
CommonTitle, | ||
CommonTitleWrapper, | ||
ItemWrapper, | ||
} from "@components/common/common.styled"; | ||
import Card from "@components/home/homeRecentTales/Card"; | ||
import { LearnedProps } from "@type/card"; | ||
|
||
import { useEffect, useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const Learned = () => { | ||
const navigate = useNavigate(); | ||
const handleMoreClick = () => { | ||
navigate("/more", { state: { learned } }); | ||
}; | ||
|
||
const [learned, setLearned] = useState<LearnedProps[]>([]); | ||
const sliceLearned = learned.slice(0, 3); | ||
|
||
useEffect(() => { | ||
const fetchGetStudiedTales = async () => { | ||
const response: LearnedProps[] = await getLearnedTales(true); | ||
setLearned(response); | ||
}; | ||
fetchGetStudiedTales(); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<CommonTitleWrapper> | ||
<CommonTitle>최근 학습한 동화</CommonTitle> | ||
<div className="more" onClick={handleMoreClick}> | ||
{"더보기 >"} | ||
</div> | ||
</CommonTitleWrapper> | ||
<ItemWrapper> | ||
{sliceLearned.map((learned: LearnedProps) => ( | ||
<Card | ||
taleId={learned.tale_id} | ||
title={learned.languageTale.title} | ||
createdAt={learned.createdAt} | ||
point={"4/10"} | ||
btnText="복습하기" | ||
// readFunction={() => handleMoreClick()} | ||
/> | ||
))} | ||
</ItemWrapper> | ||
</> | ||
); | ||
}; | ||
|
||
export default Learned; |
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,9 @@ | ||
// import { useLocation } from "react-router-dom"; | ||
|
||
const LearnedMore = () => { | ||
// const location = useLocation(); | ||
|
||
return <div>LearnedMore</div>; | ||
}; | ||
|
||
export default LearnedMore; |
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,52 @@ | ||
import { getUnlearnedTales } from "@apis/home"; | ||
import { | ||
CommonTitle, | ||
CommonTitleWrapper, | ||
ItemWrapper, | ||
} from "@components/common/common.styled"; | ||
import Card from "@components/home/homeRecentTales/Card"; | ||
import { UnLearnedProps } from "@type/card"; | ||
|
||
import { useEffect, useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const UnLearned = () => { | ||
const navigate = useNavigate(); | ||
const handleMoreClick = () => { | ||
navigate("/more", { state: { unLearned } }); | ||
}; | ||
const [unLearned, setUnLearned] = useState<UnLearnedProps[]>([]); | ||
const sliceUnLearned = unLearned.slice(0, 3); | ||
|
||
useEffect(() => { | ||
const fetchUnLearnTales = async () => { | ||
const response: UnLearnedProps[] = await getUnlearnedTales(true); | ||
setUnLearned(response); | ||
}; | ||
|
||
fetchUnLearnTales(); | ||
}, []); | ||
return ( | ||
<> | ||
<CommonTitleWrapper> | ||
<CommonTitle>아직 학습하지 않은 동화</CommonTitle> | ||
<div className="more" onClick={handleMoreClick}> | ||
{"더보기 >"} | ||
</div> | ||
</CommonTitleWrapper> | ||
<ItemWrapper> | ||
{sliceUnLearned.map((unLearned: UnLearnedProps) => ( | ||
<Card | ||
taleId={unLearned.tale_id} | ||
title={unLearned.languageTale.title} | ||
createdAt={unLearned.createdAt} | ||
btnText="학습하기✏️" | ||
readFunction={() => handleMoreClick()} | ||
/> | ||
))} | ||
</ItemWrapper> | ||
</> | ||
); | ||
}; | ||
|
||
export default UnLearned; |
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,9 @@ | ||
// import { useLocation } from "react-router-dom"; | ||
|
||
const UnLearnedMore = () => { | ||
// const location = useLocation(); | ||
|
||
return <div>UnLearnedMore</div>; | ||
}; | ||
|
||
export default UnLearnedMore; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { getWord } from "@apis/home"; | ||
import { | ||
CommonTitle, | ||
CommonTitleWrapper, | ||
} from "@components/common/common.styled"; | ||
import { WordProps } from "@type/card"; | ||
import * as S from "./Word.styled"; | ||
|
||
import { useEffect, useState } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
const Word = () => { | ||
const navigate = useNavigate(); | ||
const handleMoreClick = () => { | ||
navigate("/more", { state: { word } }); | ||
}; | ||
const [word, setWord] = useState<WordProps[]>([]); | ||
const sliceWord = word.slice(0, 6); | ||
|
||
useEffect(() => { | ||
const fetchWord = async () => { | ||
const response: WordProps[] = await getWord(); | ||
setWord(response); | ||
}; | ||
|
||
fetchWord(); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<CommonTitleWrapper> | ||
<CommonTitle>단어장</CommonTitle> | ||
<div className="more" onClick={handleMoreClick}> | ||
{"더보기 >"} | ||
</div> | ||
</CommonTitleWrapper> | ||
<S.GridWrapper> | ||
{sliceWord.map((word: WordProps) => ( | ||
<S.WordCard>{word.word}</S.WordCard> | ||
))} | ||
</S.GridWrapper> | ||
</> | ||
); | ||
}; | ||
|
||
export default Word; |
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,9 @@ | ||
// import { useLocation } from "react-router-dom"; | ||
|
||
const WordMore = () => { | ||
// const location = useLocation(); | ||
|
||
return <div>WordMore</div>; | ||
}; | ||
|
||
export default WordMore; |
Oops, something went wrong.