Skip to content

Commit 77e5bb6

Browse files
authored
refactor(uikit): simplify TablePagination styles and move them to theme (#639)
* refactor(uikit): simplify TablePagination styles and move them to theme Removed inline styles from TablePagination component and added a centralized styles definition for pagination in the theme. This improves maintainability and consistency across the UI. * Create gorgeous-bears-worry.md
1 parent 4fa64f3 commit 77e5bb6

3 files changed

Lines changed: 34 additions & 14 deletions

File tree

.changeset/gorgeous-bears-worry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tidbcloud/uikit": patch
3+
---
4+
5+
refactor(uikit): simplify TablePagination styles and move them to theme

packages/uikit/src/biz/Table/TablePagination.tsx

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,6 @@ export const ProTablePagination = <TData extends MRT_RowData>({ table, ...props
9595
total={paginationProps?.total ?? numberOfPages}
9696
value={paginationProps.value ?? pageIndex + 1}
9797
withEdges={withEdges}
98-
styles={mergeStylesList([
99-
(theme) => ({
100-
control: {
101-
border: 'none',
102-
color: theme.colors.carbon[9],
103-
borderRadius: theme.defaultRadius,
104-
'&[data-active]': {
105-
color: theme.colors.carbon[9],
106-
background: theme.colors.carbon[4]
107-
}
108-
}
109-
}),
110-
rest.styles
111-
])}
11298
{...rest}
11399
/>
114100
{showRowsPerPage && (

packages/uikit/src/theme/theme.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
AccordionProps,
44
DEFAULT_THEME,
55
MantineTheme,
6+
PaginationProps,
67
RadioIndicatorProps,
78
TagsInputProps,
89
createTheme,
@@ -1404,6 +1405,34 @@ const theme = createTheme({
14041405
}
14051406
}
14061407
}
1408+
},
1409+
Pagination: {
1410+
styles: (theme: MantineTheme, _props: PaginationProps, u: EmotionHelpers) => {
1411+
return {
1412+
control: {
1413+
border: 'none',
1414+
color: themeColor(theme, 'carbon', 9),
1415+
borderRadius: theme.defaultRadius,
1416+
backgroundColor: 'transparent',
1417+
[u.dark]: {
1418+
color: themeColor(theme, 'carbon', 8)
1419+
},
1420+
'&:hover': {
1421+
[u.light]: {
1422+
backgroundColor: themeColor(theme, 'carbon', 2)
1423+
}
1424+
},
1425+
'&[data-active]': {
1426+
color: themeColor(theme, 'carbon', 9),
1427+
border: `1px solid ${themeColor(theme, 'carbon', 5)}`,
1428+
background: themeColor(theme, 'carbon', 2),
1429+
[u.dark]: {
1430+
color: themeColor(theme, 'carbon', 8)
1431+
}
1432+
}
1433+
}
1434+
}
1435+
}
14071436
}
14081437
}
14091438
})

0 commit comments

Comments
 (0)