From 0aa341c12c252ee270264feae445de5ad36221ef Mon Sep 17 00:00:00 2001 From: Loi Phan Date: Wed, 29 Nov 2023 14:39:32 +0700 Subject: [PATCH] Format code style and remove unnecessary code --- .../src/components/Modal/styled.ts | 7 ------- .../src/components/Pagination/index.tsx | 20 +++++++++++++++---- .../src/components/Table/index.tsx | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/hotel-management/src/components/Modal/styled.ts b/hotel-management/src/components/Modal/styled.ts index 1b1cc0d..d7f850d 100644 --- a/hotel-management/src/components/Modal/styled.ts +++ b/hotel-management/src/components/Modal/styled.ts @@ -6,13 +6,6 @@ const StyledModal = styled.div` left: 50%; transform: translate(-50%, -50%); - background-color: var(--color-grey-0); - - border-radius: var(--border-radius-lg); - box-shadow: var(--shadow-lg); - - padding: 3.2rem 4rem; - transition: all 0.5s; `; diff --git a/hotel-management/src/components/Pagination/index.tsx b/hotel-management/src/components/Pagination/index.tsx index 2f73a23..a21fc53 100644 --- a/hotel-management/src/components/Pagination/index.tsx +++ b/hotel-management/src/components/Pagination/index.tsx @@ -1,7 +1,13 @@ -import { DEFAULT_PAGE_SIZE } from '@constant/config'; import { useCallback, useMemo } from 'react'; import { useSearchParams } from 'react-router-dom'; + +// Constants +import { DEFAULT_PAGE_SIZE } from '@constant/config'; + +// Styled import { Buttons, PaginationBtn, StyledPagination } from './styled'; + +// Components import { MdKeyboardArrowRight, MdKeyboardArrowLeft } from 'react-icons/md'; interface IPagination { @@ -17,14 +23,18 @@ const Pagination = ({ count }: IPagination) => { const totalPage = Math.ceil(count / DEFAULT_PAGE_SIZE); const nextPage = useCallback(() => { - const next = currentPage === totalPage ? currentPage : currentPage + 1; + const next = currentPage === totalPage + ? currentPage + : currentPage + 1; searchParams.set('page', next.toString()); setSearchParams(searchParams); }, [currentPage, searchParams, totalPage, setSearchParams]); const previousPage = useCallback(() => { - const previous = currentPage === 1 ? currentPage : currentPage - 1; + const previous = currentPage === 1 + ? currentPage + : currentPage - 1; searchParams.set('page', previous.toString()); setSearchParams(searchParams); @@ -36,7 +46,9 @@ const Pagination = ({ count }: IPagination) => { ); const toIndex = useMemo( - () => (currentPage === totalPage ? count : currentPage * DEFAULT_PAGE_SIZE), + () => (currentPage === totalPage + ? count + : currentPage * DEFAULT_PAGE_SIZE), [currentPage, count, totalPage] ); diff --git a/hotel-management/src/components/Table/index.tsx b/hotel-management/src/components/Table/index.tsx index 3dca4cd..76024e3 100644 --- a/hotel-management/src/components/Table/index.tsx +++ b/hotel-management/src/components/Table/index.tsx @@ -1,6 +1,6 @@ import { ReactNode, useContext } from 'react'; -// Components +// Styled import { StyledBody, StyledHeader,