diff --git a/packages/components/src/pagination/pagination-select.tsx b/packages/components/src/pagination/pagination-select.tsx index 6d35726089..3851029e2f 100644 --- a/packages/components/src/pagination/pagination-select.tsx +++ b/packages/components/src/pagination/pagination-select.tsx @@ -1,4 +1,4 @@ -import type { ComponentPropsWithoutRef, ReactNode } from 'react' +import type { ReactNode } from 'react' import React, { forwardRef } from 'react' import { Action } from '../action' @@ -23,8 +23,6 @@ export const PaginationSelect = forwardRef< } = props if (loading) { - console.log({ loading }) - return (
@@ -48,7 +46,7 @@ export const PaginationSelect = forwardRef< - {children} + {options.map((option) => children(option))} @@ -57,10 +55,11 @@ export const PaginationSelect = forwardRef< ) }) -export interface PaginationSelectProps extends ComponentPropsWithoutRef<'div'> { +export interface PaginationSelectProps { onValueChange?: (value: number) => void value: number options: number[] + children: (option: number) => ReactNode loading?: boolean label: ReactNode disabled?: boolean diff --git a/packages/components/src/pagination/pagination.tsx b/packages/components/src/pagination/pagination.tsx index 38944d630e..0fbf7ab531 100644 --- a/packages/components/src/pagination/pagination.tsx +++ b/packages/components/src/pagination/pagination.tsx @@ -8,7 +8,6 @@ import './pagination.css' import { SelectOption } from '../select' import { Skeleton } from '../skeleton' import { PaginationSelect } from './pagination-select' - /** * Pagination triggers allow merchants to view the size of a list and navigate between pages. * @@ -58,11 +57,11 @@ export const Pagination = forwardRef( label={`Show ${size}`} disabled={loading} > - {sizeOptions.map((option) => ( + {(option) => ( Show {option} - ))} + )} )} @@ -91,9 +90,9 @@ export const Pagination = forwardRef( loading={loading} label={`${page} of ${pageOptions.length}`} > - {pageOptions.map((option) => ( + {(option) => ( {option} - ))} + )} { expect( container.querySelector('[data-sl-pagination-actions]') ).toBeInTheDocument() + expect( + container.querySelector('[data-sl-pagination-page-select]') + ).toBeInTheDocument() expect( container.querySelector('[data-sl-pagination-total-label]') ).toBeInTheDocument()