import * as React from "react"; import { Story, Meta } from "@storybook/react"; import Pagination, { PaginationProps } from "./Pagination"; import PaginationContainer from "./PaginationContainer"; import { BorderedList } from "../list"; import usePageChange from "./usePageChange"; import { mockPaginationData as initialData } from "./mockPaginationData.json"; type ControlledPaginationWrapperProps = { children: (renderProps: { activePage: number; pageLength: number; itemEndIndex: number; itemStartIndex: number; onChange: (newPage, newPageLength) => void; }) => React.ReactElement; }; export default { title: "Navigation/Pagination", component: Pagination } as Meta; const Template: Story = args => ( ); export const Default = Template.bind({}); export const ExampleWPagedListControlledComponent = args => { const ControlledPaginationWrapper = ({ children }: ControlledPaginationWrapperProps) => { return children(usePageChange()); }; return ( {({ activePage, itemEndIndex, itemStartIndex, pageLength, onChange }) => ( <> {initialData.slice(itemStartIndex, itemEndIndex).map(name => (
  • {name}
  • ))}
    )}
    ); }; export const StartOnPageBeyond1 = Template.bind({}); StartOnPageBeyond1.args = { initialActivePage: 3 }; export const PreviousAndNextButtonsAsLinks = () => ( ); export const WithMenuForItemsPerPage = () => ( <>
    With default page length menu opts

    With large page length menu opts
    ); export const CustomItemLabel = () => ( ); export const SiblingElementsInPaginationContainer = () => (
    I'm another child of PaginationContainer
    ); export const OnlyTotalPagesSet = () => ( ); export const WithoutTotalItemsSet = () => ( ); export const WithoutPaginationContainer = () => ;