Skip to content

Commit

Permalink
카테고리, 태그, 템플릿 목록 로딩 처리 개선 (#813)
Browse files Browse the repository at this point in the history
* refactor(components): ScrollTopButton 컴포넌트 분리

* refactor(MyTemplatePage): 컴포넌트 분리 및 태그목록, 카테고리 목록 서스펜스 적용

* refactor(components): TemplateDeleteSelection, TemplateListSectionLoading 컴포넌트 분리

* refactor(src): useKeyword, useShowTemplateList, useSelectAndDeleteTemplateList 훅 분리 및 MyTemplatePage 적용

* refactor(templates): 사용하지 않는 useTemplateCategoryTagQueries 훅 삭제

* refactor(pages): useShowTemplateList => useFilteredTemplateList로 이름 변경

* refactor(src): useKeyword => useSearchKeyword로 이름 변경

* refactor(ConfirmDeleteModal): ConfirmDeleteModalProps =>Props 로 변경

* refactor(CategoryListSection): Flex 대신 스타일드 컴포넌트로 스타일 지정

* refactor(ConfirmDeleteModal): Modal 합성 컴포넌트의 하위 컴포넌트 사용하도록 변경

* refactor(queries): useSuspenseQuery를 사용하는 훅들 수동으로 error 전파
  • Loading branch information
Hain-tain authored Oct 18, 2024
1 parent cc77029 commit 1b2a3b3
Show file tree
Hide file tree
Showing 31 changed files with 637 additions and 282 deletions.
21 changes: 21 additions & 0 deletions frontend/src/components/ScrollTopButton/ScrollTopButton.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import styled from '@emotion/styled';

import { theme } from '@/style/theme';

export const ScrollTopButton = styled.button`
cursor: pointer;
position: fixed;
right: 2rem;
bottom: 2rem;
display: flex;
align-items: center;
justify-content: center;
padding: 0.75rem;
background-color: ${theme.color.light.primary_500};
border: none;
border-radius: 100%;
`;
16 changes: 16 additions & 0 deletions frontend/src/components/ScrollTopButton/ScrollTopButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ArrowUpIcon } from '@/assets/images';
import { scroll } from '@/utils';

import * as S from './ScrollTopButton.style';

const ScrollTopButton = () => (
<S.ScrollTopButton
onClick={() => {
scroll.top('smooth');
}}
>
<ArrowUpIcon aria-label='맨 위로' />
</S.ScrollTopButton>
);

export default ScrollTopButton;
1 change: 1 addition & 0 deletions frontend/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export { default as NewCategoryInput } from './NewCategoryInput/NewCategoryInput
export { default as NoSearchResults } from './NoSearchResults/NoSearchResults';
export { default as Textarea } from './Textarea/Textarea';
export { default as ContactUs } from './ContactUs/ContactUs';
export { default as ScrollTopButton } from './ScrollTopButton/ScrollTopButton';

// Skeleton UI
export { default as LoadingBall } from './LoadingBall/LoadingBall';
Expand Down
1 change: 1 addition & 0 deletions frontend/src/hooks/template/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { useSourceCode } from './useSourceCode';
export { useTag } from './useTag';
export { useSearchKeyword } from './useSearchKeyword';
8 changes: 8 additions & 0 deletions frontend/src/hooks/template/useSearchKeyword.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useInput, useDebounce } from '..';

export const useSearchKeyword = () => {
const [keyword, handleKeywordChange] = useInput('');
const debouncedKeyword = useDebounce(keyword, 300);

return { keyword, debouncedKeyword, handleKeywordChange };
};
36 changes: 3 additions & 33 deletions frontend/src/pages/MyTemplatesPage/MyTemplatePage.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ export const MainContainer = styled.main`
}
`;

export const TopBannerContainer = styled.div`
display: flex;
align-items: center;
width: 100%;
height: 10.25rem;
white-space: nowrap;
`;

export const TopBannerTextWrapper = styled.div`
display: flex;
gap: 0.5rem;
align-items: center;
margin-left: calc(12.5rem + clamp(1rem, calc(0.0888 * 100vw - 3.2618rem), 4.375rem));
`;

export const SearchInput = styled(Input)`
box-shadow: inset 1px 2px 8px #00000030;
`;
Expand All @@ -62,20 +45,7 @@ export const NewTemplateButton = styled.button`
}
`;

export const ScrollTopButton = styled.button`
cursor: pointer;
position: fixed;
right: 2rem;
bottom: 2rem;
display: flex;
align-items: center;
justify-content: center;
padding: 0.75rem;
background-color: ${theme.color.light.primary_500};
border: none;
border-radius: 100%;
export const TemplateListSectionWrapper = styled.div`
position: relative;
width: 100%;
`;
Loading

0 comments on commit 1b2a3b3

Please sign in to comment.