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 ( + + {isDropdownOpen && ( +
+
    + {options.map((option, index) => ( +
  • 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`} + > + {option} +
  • + ))} +
+
+ )} + + ); +}; + +export default FilterDropdown; diff --git a/src/components/Icon/Icon.tsx b/src/components/Icon/Icon.tsx index 2d07433..08beac9 100644 --- a/src/components/Icon/Icon.tsx +++ b/src/components/Icon/Icon.tsx @@ -1,4 +1,4 @@ -import { ComponentType, FC } from 'react'; +import { ComponentType } from 'react'; import iconSizes, { IconSize } from './iconSizes'; import { iconsNames } from './iconsNames'; @@ -10,12 +10,7 @@ interface IconProps { onClick?: () => void; } -const Icon: FC = ({ - name, - size = 'm', - className = '', - onClick, -}: IconProps) => { +const Icon = ({ name, size = 'm', className = '', onClick }: IconProps) => { const Component = iconsNames[name] as ComponentType<{ className?: string; onClick?: () => void; diff --git a/src/components/Icon/icons/Close.tsx b/src/components/Icon/icons/Close.tsx index c5f8408..c92269c 100644 --- a/src/components/Icon/icons/Close.tsx +++ b/src/components/Icon/icons/Close.tsx @@ -1,9 +1,12 @@ -import { FC } from 'react'; +import { ReactNode } from 'react'; -const Close: FC<{ className?: string; onClick?: () => void }> = ({ +const Close = ({ className, onClick, -}) => { +}: { + className?: string; + onClick?: () => void; +}): ReactNode => { return ( void }> = ({ +const Menu = ({ className, onClick, +}: { + className?: string; + onClick?: () => void; }) => { return ( void }> + ({ + className, + onClick, + }: { + className?: string; + onClick?: () => void; + }) => ReactNode > = { AlertCircle, AlternateShare, 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 }) => { void; +} + +const Pagination = ({ + currentPage, + totalPages, + onPageChange, +}: PaginationProps) => { + const isFirstPage = currentPage === 1; + const isLastPage = currentPage === totalPages; + + const calculateVisiblePages = ( + currentPage: number, + totalPages: number, + maxVisiblePages: number, + ): number[] => { + const startPage = Math.max( + 1, + currentPage - Math.floor(maxVisiblePages / 2), + ); + const endPage = Math.min(totalPages, startPage + maxVisiblePages - 1); + const adjustedStartPage = Math.max(1, endPage - maxVisiblePages + 1); + + return Array.from( + { length: endPage - adjustedStartPage + 1 }, + (_, i) => adjustedStartPage + i, + ); + }; + + const visiblePages = calculateVisiblePages(currentPage, totalPages, 5); + + return ( +
+
+ + + +
+ +
+ {visiblePages.map((page) => ( + + ))} +
+ +
+ + + +
+
+ ); +}; + +export default Pagination;