Skip to content

Commit

Permalink
Override padding-right of MuiTablePagination to fix DataGrid pagi…
Browse files Browse the repository at this point in the history
…nation select styling (#2396)

Override `padding-right` of `MuiTablePagination`

This fixes the styling of the pagination select in `DataGrid`s.
Previously, the text and icon stuck together.

---------

Co-authored-by: Ricky James Smith <[email protected]>
  • Loading branch information
thomasdax98 and jamesricky authored Aug 13, 2024
1 parent 452a12a commit c90ae39
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/long-dolls-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": patch
---

Fix spacing between page number and chevron icon in the pagination select of `DataGrid`
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { inputBaseClasses, tablePaginationClasses } from "@mui/material";

import { mergeOverrideStyles } from "../utils/mergeOverrideStyles";
import { GetMuiComponentTheme } from "./getComponentsTheme";

export const getMuiTablePagination: GetMuiComponentTheme<"MuiTablePagination"> = (component, { palette }) => ({
...component,
styleOverrides: mergeOverrideStyles<"MuiTablePagination">(component?.styleOverrides, {
select: {
[`&.${inputBaseClasses.input}.${tablePaginationClasses.select}`]: {
paddingRight: 32,
},
},
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { getMuiSvgIcon } from "./MuiSvgIcon";
import { getMuiSwitch } from "./MuiSwitch";
import { getMuiTab } from "./MuiTab";
import { getMuiTableCell } from "./MuiTableCell";
import { getMuiTablePagination } from "./MuiTablePagination";
import { getMuiTableRow } from "./MuiTableRow";
import { getMuiTabs } from "./MuiTabs";
import { getMuiToggleButton } from "./MuiToggleButton";
Expand Down Expand Up @@ -108,4 +109,5 @@ export const getComponentsTheme = (components: Components, themeData: ThemeData)
MuiToggleButtonGroup: getMuiToggleButtonGroup(components.MuiToggleButtonGroup, themeData),
MuiTooltip: getMuiTooltip(components.MuiTooltip, themeData),
MuiTypography: getMuiTypography(components.MuiTypography, themeData),
MuiTablePagination: getMuiTablePagination(components.MuiTablePagination, themeData),
});

0 comments on commit c90ae39

Please sign in to comment.