From 3ddb2e2ab21e20da68f059da73b4abb7f31e3263 Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Fri, 20 Dec 2024 02:37:01 +0900 Subject: [PATCH 01/12] =?UTF-8?q?style:=20=EC=B4=88=EA=B8=B0=20=ED=85=8C?= =?UTF-8?q?=EB=A7=88(dark)=EB=A5=BC=20=EB=AA=85=EC=8B=9C=EC=A0=81=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Layout/AppShell.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/Layout/AppShell.tsx b/src/components/Layout/AppShell.tsx index 958fb46..4691f41 100644 --- a/src/components/Layout/AppShell.tsx +++ b/src/components/Layout/AppShell.tsx @@ -14,6 +14,7 @@ const AppShell = ({ children }: { children: ReactNode }) => { Date: Fri, 20 Dec 2024 19:14:22 +0900 Subject: [PATCH 02/12] =?UTF-8?q?style:=20Pagination=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Pagination/index.tsx | 89 +++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 src/components/Pagination/index.tsx diff --git a/src/components/Pagination/index.tsx b/src/components/Pagination/index.tsx new file mode 100644 index 0000000..3fc46b1 --- /dev/null +++ b/src/components/Pagination/index.tsx @@ -0,0 +1,89 @@ +import { FC } from 'react'; + +import Icon from '../Icon/Icon'; + +interface PaginationProps { + currentPage: number; + totalPages: number; + onPageChange: (page: number) => void; +} + +const Pagination: FC = ({ + currentPage, + totalPages, + onPageChange, +}) => { + const isFirstPage = currentPage === 1; + const isLastPage = currentPage === totalPages; + + return ( +
+
+ + + +
+ +
+ {Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( + + ))} +
+ +
+ + + +
+
+ ); +}; + +export default Pagination; From 47c22540ec76f4db41556a8878664a9b3972b36b Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Fri, 20 Dec 2024 19:38:26 +0900 Subject: [PATCH 03/12] =?UTF-8?q?style:=20Pagination=EC=9D=98=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=B2=94=EC=9C=84=20=EC=A0=9C=ED=95=9C=20?= =?UTF-8?q?(5=ED=8E=98=EC=9D=B4=EC=A7=80=EA=B9=8C=EC=A7=80=20=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EA=B2=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Pagination/index.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/components/Pagination/index.tsx b/src/components/Pagination/index.tsx index 3fc46b1..65def31 100644 --- a/src/components/Pagination/index.tsx +++ b/src/components/Pagination/index.tsx @@ -16,6 +16,23 @@ const Pagination: FC = ({ const isFirstPage = currentPage === 1; const isLastPage = currentPage === totalPages; + const pageRangeCalculation = ( + currentPage: number, + totalPages: number, + maximumRange: number, + ): number[] => { + const start = Math.max(1, currentPage - Math.floor(maximumRange / 2)); + const end = Math.min(totalPages, start + maximumRange - 1); + const adjustedStart = Math.max(1, end - maximumRange + 1); + + return Array.from( + { length: end - adjustedStart + 1 }, + (_, i) => adjustedStart + i, + ); + }; + + const visiblePages = pageRangeCalculation(currentPage, totalPages, 5); + return (
@@ -43,12 +60,12 @@ const Pagination: FC = ({
- {Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( + {visiblePages.map((page) => ( + + {isOpen && ( +
+
    + {options.map((option, index) => ( +
  • handleSelect(option)} + className={`block w-[149px] h-[44px] px-[23px] py-[10px] text-gray-400 cursor-pointer hover:bg-gray-700`} + > + {option} +
  • + ))} +
+
+ )} +
+ ); +}; + +export default FilterDropdown; From faefae1724e4e55763ad4fb4fe274b5a647a5d5d Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Sat, 21 Dec 2024 00:06:34 +0900 Subject: [PATCH 07/12] =?UTF-8?q?style:=20=ED=86=A0=EA=B8=80=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterDropdown/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/FilterDropdown/index.tsx b/src/components/FilterDropdown/index.tsx index 92196c3..e9bcc2e 100644 --- a/src/components/FilterDropdown/index.tsx +++ b/src/components/FilterDropdown/index.tsx @@ -1,4 +1,5 @@ import { FC, useState } from 'react'; +import Icon from '../Icon/Icon'; interface FilterDropdownProps { options: string[]; @@ -27,8 +28,13 @@ const FilterDropdown: FC = ({ onClick={() => setIsOpen(!isOpen)} > {selected} - {/* gray-300 */} - {isOpen ? '▲' : '▼'} + + {isOpen ? ( + + ) : ( + + )} + {isOpen && ( From a135af10b9d14cb6d3d79752918b35c7942e478a Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Sat, 21 Dec 2024 00:11:29 +0900 Subject: [PATCH 08/12] =?UTF-8?q?chore:=20=EC=A0=91=EA=B7=BC=EC=84=B1=20?= =?UTF-8?q?=EA=B3=A0=EB=A0=A4=EB=A5=BC=20=EC=9C=84=ED=95=9C=20aria-label?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterDropdown/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/FilterDropdown/index.tsx b/src/components/FilterDropdown/index.tsx index e9bcc2e..fde0fdf 100644 --- a/src/components/FilterDropdown/index.tsx +++ b/src/components/FilterDropdown/index.tsx @@ -22,10 +22,11 @@ const FilterDropdown: FC = ({ return (
- {isOpen && ( + {isDropdownOpen && (
    {options.map((option, index) => ( From 5a0a531432abc252d32a99f158ca3ac2cc209762 Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Sat, 21 Dec 2024 00:51:28 +0900 Subject: [PATCH 10/12] =?UTF-8?q?feat:=20=EB=93=9C=EB=A1=AD=EB=8B=A4?= =?UTF-8?q?=EC=9A=B4=20=EC=A0=91=EA=B7=BC=EC=84=B1=20=EA=B0=9C=EC=84=A0?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20aria-expanded=20=EB=B0=8F=20ro?= =?UTF-8?q?le=20=EC=86=8D=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterDropdown/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/FilterDropdown/index.tsx b/src/components/FilterDropdown/index.tsx index 3064748..656e76f 100644 --- a/src/components/FilterDropdown/index.tsx +++ b/src/components/FilterDropdown/index.tsx @@ -42,6 +42,7 @@ const FilterDropdown: FC = ({ {isDropdownOpen && ( -
    +
      {options.map((option, index) => (
    • handleSelect(option)} + aria-current={option === selected ? 'true' : undefined} className={`block w-[149px] h-[44px] px-[23px] py-[10px] text-gray-400 cursor-pointer hover:bg-gray-800`} > {option} From 0ea5c0bae552ab9f0fc72cb16868810d98d5f103 Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Sat, 21 Dec 2024 00:56:35 +0900 Subject: [PATCH 11/12] =?UTF-8?q?refactor:=20=EB=AA=85=ED=99=95=ED=95=9C?= =?UTF-8?q?=20=EB=B3=80=EC=88=98=EB=AA=85=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FilterDropdown/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/FilterDropdown/index.tsx b/src/components/FilterDropdown/index.tsx index 656e76f..5af6bad 100644 --- a/src/components/FilterDropdown/index.tsx +++ b/src/components/FilterDropdown/index.tsx @@ -32,7 +32,7 @@ const FilterDropdown: FC = ({ return () => document.removeEventListener('mousedown', handleClickOutside); }, []); - const handleSelect = (option: string) => { + const handleOptionSelect = (option: string) => { onChange(option); setIsDropdownOpen(false); }; @@ -66,7 +66,7 @@ const FilterDropdown: FC = ({ {options.map((option, index) => (
    • handleSelect(option)} + onClick={() => handleOptionSelect(option)} aria-current={option === selected ? 'true' : undefined} className={`block w-[149px] h-[44px] px-[23px] py-[10px] text-gray-400 cursor-pointer hover:bg-gray-800`} > From f18e3732c1de4605077e160a387c6867a80f5f48 Mon Sep 17 00:00:00 2001 From: Dahyeon Jin Date: Mon, 23 Dec 2024 00:31:11 +0900 Subject: [PATCH 12/12] =?UTF-8?q?refactor:=20children=20=EA=B0=95=EC=A0=9C?= =?UTF-8?q?=EC=84=B1=20=EC=A0=9C=EC=99=B8=EB=A5=BC=20=EC=9C=84=ED=95=B4=20?= =?UTF-8?q?React.FC=20=ED=83=80=EC=9E=85=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Button/CategoryButton.tsx | 6 ++---- src/components/Button/FollowButton.tsx | 6 +++--- src/components/Button/SquareButtonL.tsx | 6 ++---- src/components/FilterDropdown/index.tsx | 6 +++--- src/components/Icon/Icon.tsx | 9 ++------- src/components/Icon/icons/Close.tsx | 9 ++++++--- src/components/Icon/icons/Menu.tsx | 7 ++++--- src/components/Icon/iconsNames.ts | 10 ++++++++-- src/components/Pagination/index.tsx | 6 ++---- 9 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/components/Button/CategoryButton.tsx b/src/components/Button/CategoryButton.tsx index e3a14fb..927ae96 100644 --- a/src/components/Button/CategoryButton.tsx +++ b/src/components/Button/CategoryButton.tsx @@ -1,8 +1,6 @@ import { CategoryButtonProps } from '@/types'; -import { FC } from 'react'; - -const CategoryButton: FC = ({ +const CategoryButton = ({ backgroundColor = 'bg-gray-800', textColor = 'text-gray-300', textSize, @@ -10,7 +8,7 @@ const CategoryButton: FC = ({ onClick, ariaLabel, -}) => { +}: CategoryButtonProps) => { return (