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 SelectColumnsButton styles #8391

Merged
merged 1 commit into from
Nov 14, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ViewWeekIcon from '@mui/icons-material/ViewWeek';

import { FieldEditor } from './FieldEditor';
import { ConfigurableDatagridColumn } from './DatagridConfigurable';
import { styled } from '@mui/material/styles';

/**
* Renders a button that lets users show / hide columns in a configurable datagrid
Expand Down Expand Up @@ -99,14 +100,13 @@ export const SelectColumnsButton = props => {
</IconButton>
</Tooltip>
) : (
<Button
<StyledButton
size="small"
onClick={handleClick}
startIcon={<ViewWeekIcon />}
sx={{ '&.MuiButton-sizeSmall': { lineHeight: 1.5 } }}
>
{title}
</Button>
</StyledButton>
)}
<Popover
open={Boolean(anchorEl)}
Expand Down Expand Up @@ -138,6 +138,16 @@ export const SelectColumnsButton = props => {
);
};

const StyledButton = styled(Button, {
name: 'RaSelectColumnsButton',
overridesResolver: (props, styles) => styles.root,
})({
'&.MuiButton-sizeSmall': {
// fix for icon misalignment on small buttons, see https://github.com/mui/material-ui/pull/30240
lineHeight: 1.5,
},
});

export interface SelectColumnsButtonProps {
preferenceKey: string;
}