-
Notifications
You must be signed in to change notification settings - Fork 8
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
좋아요한 템플릿 목록 페이지 생성 및 캐로셀 스크롤로 변경 #872
Conversation
useEffect(() => { | ||
const sentinel = sentinelRef.current; | ||
|
||
if (!sentinel) { | ||
return; | ||
} | ||
|
||
const observerOptions: IntersectionObserverInit = { | ||
root: null, | ||
rootMargin: '0px', | ||
threshold: [0, 1.0], | ||
}; | ||
|
||
const observerCallback: IntersectionObserverCallback = (entries) => { | ||
// entries[0].isIntersecting이 false일 때 (sentinel이 화면에서 벗어났을 때) 버튼 보여줌 | ||
const entry = entries[0]; | ||
const shouldShow = !entry.isIntersecting || entry.intersectionRatio < 1; | ||
|
||
void setIsVisible(shouldShow); | ||
}; | ||
|
||
const observer = new IntersectionObserver(observerCallback, observerOptions); | ||
|
||
observer.observe(sentinel); | ||
|
||
// eslint-disable-next-line consistent-return | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}, []); |
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.
오 이렇게 로직을 쓰는군요?!
<Flex direction='column' gap='0.5rem'> | ||
<S.EllipsisTextWrapper> | ||
<Text.XLarge color={theme.color.light.secondary_900} weight='bold'> | ||
{title} | ||
</Text.XLarge> | ||
</S.EllipsisTextWrapper> |
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.
여기는 gap이 추가된걸까요?!
<Heading.XLarge color={theme.color.light.primary_500}>403 ERROR</Heading.XLarge> | ||
<Flex direction='column' gap='2rem' align='center'> | ||
<Text.XLarge color={theme.color.light.primary_500} weight='bold'> | ||
죄송합니다. 해당 페이지에 접근할 수 있는 권한이 없습니다. |
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.
사소하지만 '죄송합니다.' 표현이 없어도 될 것 같다는 생각이네요 ㅎㅎ
import { Link, useParams } from 'react-router-dom'; | ||
|
||
import { Flex, Heading, LoadingBall, NoResults, PagingButtons, TemplateCard } from '@/components'; | ||
import { useQueryParams, useWindowWidth } from '@/hooks'; | ||
import { useAuth } from '@/hooks/authentication'; | ||
import { ForbiddenPage } from '@/pages'; | ||
import { useLikedTemplateListQuery } from '@/queries/templates/useLikedTemplateListQuery'; | ||
import { ROUTE_END_POINT } from '@/routes/endPoints'; | ||
import { useTrackPageViewed } from '@/service/amplitude'; | ||
|
||
import { TemplateListSectionLoading } from '../MyTemplatesPage/components'; | ||
import * as S from './MyLikedTemplatePage.style'; | ||
|
||
const getGridCols = (windowWidth: number) => (windowWidth <= 1024 ? 1 : 2); | ||
|
||
const MyLikedTemplatePage = () => { |
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.
해당 페이지는 중복이 많아 추후 리팩토링이 필요해보이네요~!
return isSearching ? <NoSearchResults /> : <NewTemplateButton />; | ||
return isSearching ? <NoResults>검색 결과가 없습니다.</NoResults> : <NewTemplateButton />; |
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.
재활용 가능하게 바뀐 부분 좋네요~
@@ -28,3 +29,21 @@ export const END_POINTS = { | |||
LOGIN_CHECK: '/login/check', | |||
CHECK_NAME: '/check-name', | |||
} as const; | |||
|
|||
export const ROUTE_END_POINT = { |
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.
변수명은 ROUTE만 있어도 좋을 것 같고, 어느 부분에는 적용이 되어있지 않은 것 같아서 이것도 리팩토링 목록으로 넣어두겠습니당
⚡️ 관련 이슈
close - #846
📍주요 변경 사항
🎸기타
🍗 PR 첫 리뷰 마감 기한
10/24