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

Fix spacing for ListItemIcon and ListItemAvatar #3416

Merged
merged 6 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/little-comics-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-theme": patch
---

Fix spacing for `ListItemIcon` and `ListItemAvatar` to align with Comet DXP design
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { mergeOverrideStyles } from "../utils/mergeOverrideStyles";
import { GetMuiComponentTheme } from "./getComponentsTheme";

export const getMuiListItem: GetMuiComponentTheme<"MuiListItem"> = (component) => ({
export const getMuiListItem: GetMuiComponentTheme<"MuiListItem"> = (component, { spacing }) => ({
...component,
defaultProps: {
dense: true,
...component?.defaultProps,
},
styleOverrides: mergeOverrideStyles<"MuiListItem">(component?.styleOverrides, {
root: {
gap: spacing(2),
},
}),
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { mergeOverrideStyles } from "../utils/mergeOverrideStyles";
import { GetMuiComponentTheme } from "./getComponentsTheme";

export const getMuiListItemAvatar: GetMuiComponentTheme<"MuiListItemAvatar"> = (component, { spacing }) => ({
...component,
styleOverrides: mergeOverrideStyles<"MuiListItemAvatar">(component?.styleOverrides, {
root: {
minWidth: 0,
},
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { getMuiInputBase } from "./MuiInputBase";
import { getMuiLinearProgress } from "./MuiLinearProgress";
import { getMuiLink } from "./MuiLink";
import { getMuiListItem } from "./MuiListItem";
import { getMuiListItemAvatar } from "./MuiListItemAvatar";
import { getMuiListItemIcon } from "./MuiListItemIcon";
import { getMuiMenu } from "./MuiMenu";
import { getMuiNativeSelect } from "./MuiNativeSelect";
Expand Down Expand Up @@ -101,6 +102,7 @@ export const getComponentsTheme = (components: Components, themeData: ThemeData)
MuiLink: getMuiLink(components.MuiLink, themeData),
MuiListItem: getMuiListItem(components.MuiListItem, themeData),
MuiListItemIcon: getMuiListItemIcon(components.MuiListItemIcon, themeData),
MuiListItemAvatar: getMuiListItemAvatar(components.MuiListItemAvatar, themeData),
MuiMenu: getMuiMenu(components.MuiMenu, themeData),
MuiNativeSelect: getMuiNativeSelect(components.MuiNativeSelect, themeData),
MuiPaper: getMuiPaper(components.MuiPaper, themeData),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function ContentScopeSelect<Value extends ContentScopeInterface = Content

return (
<>
<ListItemIcon sx={{ minWidth: "none" }}>
<ListItemIcon>
<Domain />
</ListItemIcon>
<ListItemText
Expand Down