Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs(web-react, web): Add Pagination demo #DS-903 #1060

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import React from 'react';
import { ComponentStory } from '@storybook/react';
import { SpiritPaginationProps } from '../../../types';
import Pagination from '../Pagination';
import PaginationItem from '../PaginationItem';
import PaginationLink from '../PaginationLink';
import PaginationLinkNext from '../PaginationLinkNext';

const Story: ComponentStory<typeof Pagination> = (args: SpiritPaginationProps) => <Pagination {...args} />;
const PaginationCurrentFirst = () => (
<Pagination>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</Pagination>
);

Story.args = {
children: (
<>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</>
),
};

export default Story;
export default PaginationCurrentFirst;
Original file line number Diff line number Diff line change
@@ -1,37 +1,30 @@
import React from 'react';
import { ComponentStory } from '@storybook/react';
import { SpiritPaginationProps } from '../../../types';
import Pagination from '../Pagination';
import PaginationItem from '../PaginationItem';
import PaginationLink from '../PaginationLink';
import PaginationLinkNext from '../PaginationLinkNext';

const Story: ComponentStory<typeof Pagination> = (args: SpiritPaginationProps) => <Pagination {...args} />;
const PaginationCurrentFirstCentered = () => (
<Pagination UNSAFE_className="text-center">
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</Pagination>
);

Story.args = {
UNSAFE_className: 'text-center',
children: (
<>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</>
),
};

export default Story;
export default PaginationCurrentFirstCentered;
Original file line number Diff line number Diff line change
@@ -1,36 +1,30 @@
import React from 'react';
import { ComponentStory } from '@storybook/react';
import { SpiritPaginationProps } from '../../../types';
import Pagination from '../Pagination';
import PaginationItem from '../PaginationItem';
import PaginationLink from '../PaginationLink';
import PaginationLinkPrevious from '../PaginationLinkPrevious';

const Story: ComponentStory<typeof Pagination> = (args: SpiritPaginationProps) => <Pagination {...args} />;
const PaginationCurrentLast = () => (
<Pagination>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 109" pageNumber={109} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 110" pageNumber={110} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 111" pageNumber={111} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 112" pageNumber={112} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 113" pageNumber={113} />
</PaginationItem>
</Pagination>
);

Story.args = {
children: (
<>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 109" pageNumber={109} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 110" pageNumber={110} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 111" pageNumber={111} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 112" pageNumber={112} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 113" pageNumber={113} />
</PaginationItem>
</>
),
};

export default Story;
export default PaginationCurrentLast;
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
import React from 'react';
import { ComponentStory } from '@storybook/react';
import { SpiritPaginationProps } from '../../../types';
import Pagination from '../Pagination';
import PaginationItem from '../PaginationItem';
import PaginationLink from '../PaginationLink';
import PaginationLinkNext from '../PaginationLinkNext';
import PaginationLinkPrevious from '../PaginationLinkPrevious';

const Story: ComponentStory<typeof Pagination> = (args: SpiritPaginationProps) => <Pagination {...args} />;
const PaginationCurrentMiddle = () => (
<Pagination>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 11" pageNumber={11} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 12" pageNumber={12} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 13" pageNumber={13} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 14" pageNumber={14} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 15" pageNumber={15} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</Pagination>
);

Story.args = {
children: (
<>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 11" pageNumber={11} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 12" pageNumber={12} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 13" pageNumber={13} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 14" pageNumber={14} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 15" pageNumber={15} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</>
),
};

export default Story;
export default PaginationCurrentMiddle;
91 changes: 4 additions & 87 deletions packages/web-react/src/components/Pagination/demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,21 @@ import PaginationCurrentFirst from './PaginationCurrentFirst';
import PaginationCurrentMiddle from './PaginationCurrentMiddle';
import PaginationCurrentLast from './PaginationCurrentLast';
import PaginationCurrentFirstCentered from './PaginationCurrentFirstCentered';
import PaginationItem from '../PaginationItem';
import PaginationLink from '../PaginationLink';
import PaginationLinkNext from '../PaginationLinkNext';
import PaginationLinkPrevious from '../PaginationLinkPrevious';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
<IconsProvider value={icons}>
<DocsSection title="Pagination Current First">
<PaginationCurrentFirst>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</PaginationCurrentFirst>
<PaginationCurrentFirst />
</DocsSection>
<DocsSection title="Pagination Current Middle">
<PaginationCurrentMiddle>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 11" pageNumber={11} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 12" pageNumber={12} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 13" pageNumber={13} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 14" pageNumber={14} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 15" pageNumber={15} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</PaginationCurrentMiddle>
<PaginationCurrentMiddle />
</DocsSection>
<DocsSection title="Pagination Current Last">
<PaginationCurrentLast>
<PaginationItem>
<PaginationLinkPrevious href="#" />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 109" pageNumber={109} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 110" pageNumber={110} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 111" pageNumber={111} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 112" pageNumber={112} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 113" pageNumber={113} />
</PaginationItem>
</PaginationCurrentLast>
<PaginationCurrentLast />
</DocsSection>
<DocsSection title="Pagination Current First Centered">
<PaginationCurrentFirstCentered UNSAFE_className="text-center">
<PaginationItem>
<PaginationLink href="#" isCurrent accessibilityLabel="Current Page, Page 1" pageNumber={1} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 2" pageNumber={2} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 3" pageNumber={3} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 4" pageNumber={4} />
</PaginationItem>
<PaginationItem>
<PaginationLink href="#" accessibilityLabel="Go to Page 5" pageNumber={5} />
</PaginationItem>
<PaginationItem>
<PaginationLinkNext href="#" />
</PaginationItem>
</PaginationCurrentFirstCentered>
<PaginationCurrentFirstCentered />
</DocsSection>
</IconsProvider>
</React.StrictMode>,
Expand Down
Loading