-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Archive Page Markup #67
Conversation
๊ตฌ์ฌ ์์ด์คํฌ๋ฆผ ํผ ๋ฏธ์ณค๋ค์,, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋๋ฌด ๊ณ ์๋ง์ผ์ จ์ต๋๋ค !!! ๐
|
||
interface Props { | ||
isOpen: boolean; | ||
setIsOpen: Dispatch<SetStateAction<boolean>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํน์ setIsOpen์ผ๋ก setState๋ฅผ ์ง์ ์ฃผ์
๋ฐ๊ธฐ๋ณด๋ค๋
onBackClick ๋ฑ ์ด๋ฒคํธ ๋ฐ์ ์ callback์ ์ฃผ์
๋ฐ์์ back button์ ๋ฃ์ด์ฃผ๋๊ฑด ์ด๋ป๊ฒ ์๊ฐํ์๋์ ?
์ง์ ์ฃผ์
๋ฐ๋ ๊ฒ์ ๋นํด์ ์์กด์ฑ์ ๋์ด๋ผ ์ ์๋ค๋ ์ฅ์ ์ด ์์ ๊ฒ ๊ฐ์์์..!
useEffect(() => { | ||
if (activeMarbleIdx === -1) return; | ||
|
||
const activeMarbleId = marbleList[activeMarbleIdx].id; | ||
const updatedIsViewedMarbleList = [ | ||
...new Set([...isViewedMarbleList, activeMarbleId]), | ||
]; | ||
setIsViewedMarbleList(updatedIsViewedMarbleList); | ||
}, [activeMarbleIdx]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ฌ๊ธฐ useEffect๋ ํจ์๋ก ์นํํ ์ ์์ ๊ฒ ๊ฐ์์ ..!
์ฌ๊ธฐ์ useEffect๊ฐ ํ์ํ์ง ์๋ค๊ณ ๋๋ผ๋ ์ด์ ๋, ์ํ์ ํ์ํจ๊ณผ๋ฅผ ์ผ์ผํค๊ธฐ์ํด ์ฌ์ฉ๋๋ useEffect๋ ์ง์ํ๋๊ฒ ์ข๋ค๊ณ ๊ฐ์ธ์ ์ผ๋ก๋ ์๊ฐํ๊ณ ์์ด์์
๋๋ค !
์ํ๊ฐ ๋ง๊ณ ๋ณต์กํด์ง ๊ฒฝ์ฐ ์ํ๋ณ๊ฒฝ์ผ๋ก ์ธํ ๋ถ์ํจ๊ณผ๋ฅผ ๋๋ฒ๊น
ํ๊ธฐ๊ฐ ์ด๋ ค์ ๋ ๊ฒฝํ์ด ์์ด์
๊ฐ์ธ์ ์ผ๋ก๋ ์ต๋ํ handler, ํน์ ๋ณ๊ฒฝ์ด trigger ๋๋ ์ชฝ์ผ๋ก ์ํ๋ณ๊ฒฝ์ ์์ฑํด์ฃผ๊ณ ์์ด์ !
const removeDupItem = <T>(arr: T[], item: T) => {
return Array.from(new Set([...arr, item]));
}
// ...
{
onSlideChange: ({ realIndex: activeMarbleIdx }: SwiperCore) => {
if (activeMarbleIdx === -1) return;
const _id = marbleList[activeMarbleIdx].id;
const newList = removeDupItem(isViewedMarbleList, _id);
setIsViewedMarbleList(newList);
}
}
์กฐ๊ธ ๋ ๋ณ๊ฒฝํ์๋ฉด setIsViewedMarbleList ์ฃผ์ ๋ ์ธํฐํ์ด์ค๋ก ๋์ด์ฌ๋ ค์ค ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค..!
{
// ...props
onIdChange: (updatedId) => void;
}
// ...
{
onSlideChange: ({ realIndex: activeMarbleIdx }: SwiperCore) =>
onIdChange(activeMarbleIdx);
}
// ์ปดํฌ๋ํธ ์ฌ์ฉ์ฒ
<MarbleModal
onIdChange={(updatedId) => {
const _id = marbleList[activeMarbleIdx].id;
const newList = removeDupItem(isViewedMarbleList, _id);
setIsViewedMarbleList(newList);
}}
/>
์ด๋ ๊ฒ ํ๋ฉด MarbleModal์ isViewedMarbleList, setIsViewedMarbleList prop์ ์ฃผ์ ํ์ง์๊ณ ์์กด์ฑ์ ๋์ด๋ผ ์ ์์ ๊ฒ ๊ฐ์์..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@2-NOW
์ ๋ถ๋ถ์ description์ ์ ์ด๋จ๋ ๊ฒ๊ณผ ๊ฐ์ด archive page ์ต์๋จ์์ ์ํ๋ฅผ ๊ด๋ฆฌํ ์๊ฐ์
๋๋ค.
์์ฑํด์ฃผ์ ๋ฆฌ๋ทฐ ์ฐธ๊ณ ํด์ modal open state์ viewedList ์ํ ๊ด๋ฆฌ๋ฅผ ๋์ด์ฌ๋ ค ๋ณด๋๋ก ํ ๊ฒ์
์ต๊ณ ์ ๋ฆฌ๋ทฐ์ด ๋ ๊ฐ์ฌํฉ๋น ๐ช๐ป
์ด๊ฒ์ด ์ฝ๋๋ค ๐ |
conflict ํด๊ฒฐํ๊ณ ๋ณํฉํ๋ฉด ๋ ๊ฒ๊ฐ์ต๋๋ค ..! @Jungjjeong |
๐โ Summary (์์ฝ)
์ฐธ๊ณ
archive page
์ต์๋จ์์ ๊ด๋ฆฌํ ์์ ์ ๋๋ค.addAfterStyle
variableuseMemo
์ฌ์ฉํ์ฌisOverflow
๊ฐ์ ๋ฐ๋ฅธ ๋ฆฌ๋ ๋๋ง๊ณผ ์๊ด ์์ด ๊ฐ์ด ์ ์ง๋๊ฒ ๋ณ๊ฒฝ๐ค Describe your Change (๋ณ๊ฒฝ์ฌํญ)
1. priview Page
related Components
related Assets
2. marble canvas Page
2024-01-07.6.47.12.1.mov
related Components
related Assets
3. marble Grid page
related Components
related Assets
4. Common Components
usage
๐ Issue number and link (์ฐธ๊ณ )
TODO
1. preview page
2. marble-canvas page
3. marble-grid page