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

chore(pagination): add playground stories for stable and unstable pagination #12441

Merged
merged 4 commits into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
93 changes: 93 additions & 0 deletions packages/react/src/components/Pagination/Pagination.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,96 @@ export const PaginationWithCustomPageSizesLabel = (args) => {

PaginationWithCustomPageSizesLabel.storyName =
'Pagination with custom page sizes label';

export const Playground = (args) => <Pagination {...args} />;

Playground.argTypes = {
className: {
control: false,
},
id: {
control: false,
},
backwardText: {
control: {
type: 'text',
},
defaultValue: 'Previous page',
},
forwardText: {
control: {
type: 'text',
},
defaultValue: 'Next page',
},
disabled: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
isLastPage: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
itemsPerPageText: {
control: {
type: 'text',
},
defaultValue: 'Items per page:',
},
page: {
control: {
type: 'number',
},
defaultValue: 1,
},
pageInputDisabled: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
pageSize: {
control: {
type: 'number',
},
defaultValue: 10,
},
pageSizes: {
control: {
type: 'array',
},
defaultValue: [10, 20, 30, 40, 50],
},
pageNumberText: {
control: {
type: 'text',
},
defaultValue: 'Page Number',
},
pagesUnknown: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
pageSizeInputDisabled: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
size: {
options: ['sm', 'md', 'lg'],
control: { type: 'select' },
},
totalItems: {
control: {
type: 'number',
},
defaultValue: 103,
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import {
unstable_PageSelector as PageSelector,
unstable_Pagination as Pagination,
} from '../../../';
} from '../../..';

const props = () => ({
disabled: boolean('Disable backward/forward buttons (disabled)', false),
Expand Down Expand Up @@ -74,3 +74,68 @@ export const WithNoSizerChildInputOrChildSelector = () => (

WithNoSizerChildInputOrChildSelector.storyName =
'with no sizer, child input, or child selector';

export const Playground = (args) => <Pagination {...args} />;

Playground.argTypes = {
className: {
control: false,
},
children: {
control: false,
},
id: {
control: false,
},
forwardText: {
control: {
type: 'text',
},
defaultValue: 'Next page',
},
disabled: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
itemRangeText: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

itemText also needs control: false

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In both this an the other story as well I think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, added!

control: false,
},
itemsPerPageText: {
control: {
type: 'text',
},
defaultValue: 'Items per page:',
},
initialPage: {
control: {
type: 'number',
},
defaultValue: 1,
},
pageSize: {
control: {
type: 'number',
},
defaultValue: 10,
},
pageSizes: {
control: {
type: 'array',
},
defaultValue: [10, 20, 30, 40, 50],
},
pagesUnknown: {
control: {
type: 'boolean',
},
defaultValue: 'false',
},
totalItems: {
control: {
type: 'number',
},
defaultValue: 350,
},
};