File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export interface PagerProps extends Pick<PaginationProps, 'itemRender'> {
8
8
page : number ;
9
9
active ?: boolean ;
10
10
className ?: string ;
11
+ style ?: React . CSSProperties ;
11
12
showTitle : boolean ;
12
13
onClick ?: ( page : number ) => void ;
13
14
onKeyPress ?: (
@@ -23,6 +24,7 @@ const Pager: React.FC<PagerProps> = (props) => {
23
24
page,
24
25
active,
25
26
className,
27
+ style,
26
28
showTitle,
27
29
onClick,
28
30
onKeyPress,
@@ -54,6 +56,7 @@ const Pager: React.FC<PagerProps> = (props) => {
54
56
< li
55
57
title = { showTitle ? String ( page ) : null }
56
58
className = { cls }
59
+ style = { style }
57
60
onClick = { handleClick }
58
61
onKeyDown = { handleKeyPress }
59
62
tabIndex = { 0 }
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ const Pagination: React.FC<PaginationProps> = (props) => {
36
36
prefixCls = 'rc-pagination' ,
37
37
selectPrefixCls = 'rc-select' ,
38
38
className,
39
+ classNames : paginationClassNames ,
40
+ styles,
39
41
40
42
// control
41
43
current : currentProp ,
@@ -332,6 +334,8 @@ const Pagination: React.FC<PaginationProps> = (props) => {
332
334
showTitle,
333
335
itemRender,
334
336
page : - 1 ,
337
+ className : paginationClassNames ?. item ,
338
+ style : styles ?. item ,
335
339
} ;
336
340
337
341
const prevPage = current - 1 > 0 ? current - 1 : 0 ;
Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ export interface PaginationLocale {
18
18
page_size ?: string ;
19
19
}
20
20
21
+ type SemanticName = 'item' ;
22
+
21
23
export interface PaginationData {
24
+ styles ?: Partial < Record < SemanticName , React . CSSProperties > > ;
25
+ classNames ?: Partial < Record < SemanticName , string > > ;
22
26
className : string ;
23
27
selectPrefixCls : string ;
24
28
prefixCls : string ;
Original file line number Diff line number Diff line change @@ -241,6 +241,19 @@ describe('Controlled Pagination', () => {
241
241
} ) ;
242
242
243
243
describe ( 'Other props' , ( ) => {
244
+ it ( 'support classnames and styles' , ( ) => {
245
+ const { container } = render (
246
+ < Pagination
247
+ total = { 1000 }
248
+ current = { 12 }
249
+ classNames = { { item : 'custom-test' } }
250
+ styles = { { item : { color : 'red' } } }
251
+ /> ,
252
+ ) ;
253
+ const item = container . querySelector ( '.rc-pagination-item' ) ;
254
+ expect ( item ) . toHaveClass ( 'custom-test' ) ;
255
+ expect ( item ) . toHaveStyle ( 'color: red' ) ;
256
+ } ) ;
244
257
it ( 'should support custom default icon' , ( ) => {
245
258
const nextIcon = ( ) => < span > nextIcon</ span > ;
246
259
const prevIcon = ( ) => < span > prevIcon</ span > ;
You can’t perform that action at this time.
0 commit comments