Add "shouldForwardProp" util function

This commit is contained in:
schroda
2024-09-27 20:34:32 +02:00
parent 8f4da52d1f
commit df420710ae
5 changed files with 55 additions and 25 deletions

View File

@@ -8,12 +8,14 @@
import { styled } from '@mui/material/styles';
import Typography, { TypographyProps } from '@mui/material/Typography';
import { shouldForwardProp } from '@/lib/ui/ShouldForwardProp.ts';
export const StyledGroupHeader = styled(Typography, { shouldForwardProp: (prop) => prop !== 'isFirstItem' })<
{
isFirstItem: boolean;
} & TypographyProps
>(({ theme, isFirstItem }) => ({
type StyledGroupHeaderProps = {
isFirstItem: boolean;
};
export const StyledGroupHeader = styled(Typography, {
shouldForwardProp: shouldForwardProp<StyledGroupHeaderProps>(['isFirstItem']),
})<StyledGroupHeaderProps & TypographyProps>(({ theme, isFirstItem }) => ({
paddingLeft: theme.spacing(3),
// 16px - 10px (bottom padding of the group items)
paddingTop: theme.spacing(0.75),