File tree Expand file tree Collapse file tree 5 files changed +72
-1
lines changed Expand file tree Collapse file tree 5 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ title: Pagination
33componentId : pagination
44description : Use Pagination to display a sequence of links that allow navigation to discrete, related pages.
55source : https://github.com/primer/react/blob/main/src/Pagination/Pagination.tsx
6+ storybook : ' /react/storybook?path=/story/components-pagination-features--hide-page-numbers'
67status : Alpha
78---
89
Original file line number Diff line number Diff line change 31063106 "name" : " Pagination" ,
31073107 "status" : " alpha" ,
31083108 "a11yReviewed" : false ,
3109- "stories" : [],
3109+ "stories" : [
3110+ {
3111+ "id" : " components-pagination--default" ,
3112+ "code" : " () => (\n <Pagination\n pageCount={15}\n currentPage={2}\n onPageChange={(e) => e.preventDefault()}\n />\n )"
3113+ }
3114+ ],
31103115 "props" : [
31113116 {
31123117 "name" : " currentPage" ,
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { Meta } from '@storybook/react'
3+ import { ComponentProps } from '../utils/types'
4+ import Pagination from './Pagination'
5+
6+ export default {
7+ title : 'Components/Pagination/Features' ,
8+ component : Pagination ,
9+ } as Meta < ComponentProps < typeof Pagination > >
10+
11+ export const LargerPageCountMargin = ( ) => (
12+ < Pagination pageCount = { 15 } currentPage = { 5 } marginPageCount = { 4 } onPageChange = { e => e . preventDefault ( ) } />
13+ )
14+
15+ export const HidePageNumbers = ( ) => (
16+ < Pagination pageCount = { 15 } currentPage = { 5 } showPages = { false } onPageChange = { e => e . preventDefault ( ) } />
17+ )
18+
19+ export const HigherSurroundingPageCount = ( ) => (
20+ < Pagination pageCount = { 15 } currentPage = { 5 } surroundingPageCount = { 4 } onPageChange = { e => e . preventDefault ( ) } />
21+ )
Original file line number Diff line number Diff line change 1+ import React from 'react'
2+ import { Meta , Story } from '@storybook/react'
3+ import { ComponentProps } from '../utils/types'
4+ import Pagination from './Pagination'
5+
6+ export default {
7+ title : 'Components/Pagination' ,
8+ component : Pagination ,
9+ } as Meta < ComponentProps < typeof Pagination > >
10+
11+ export const Default = ( ) => < Pagination pageCount = { 15 } currentPage = { 2 } onPageChange = { e => e . preventDefault ( ) } />
12+
13+ export const Playground : Story < ComponentProps < typeof Pagination > > = args => (
14+ < Pagination onPageChange = { e => e . preventDefault ( ) } { ...args } />
15+ )
16+
17+ Playground . args = {
18+ currentPage : 5 ,
19+ marginPageCount : 1 ,
20+ pageCount : 15 ,
21+ showPages : true ,
22+ surroundingPageCount : 2 ,
23+ }
24+ Playground . argTypes = {
25+ hrefBuilder : {
26+ control : false ,
27+ table : {
28+ disable : true ,
29+ } ,
30+ } ,
31+ onPageChange : {
32+ control : false ,
33+ table : {
34+ disable : true ,
35+ } ,
36+ } ,
37+ theme : {
38+ control : false ,
39+ table : {
40+ disable : true ,
41+ } ,
42+ } ,
43+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const allowlist = [
2727 'FilteredActionList' ,
2828 'Link' ,
2929 'Pagehead' ,
30+ 'Pagination' ,
3031 'Radio' ,
3132 'RadioGroup' ,
3233 'Select' ,
You can’t perform that action at this time.
0 commit comments