-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow extending slots from Admin components
Extending a Comet Admin component using `styled()` requires the `className` prop to be passed through to the components `root` slot. Also added the `ThemedComponentBaseProps` type to use as a base for components props. This abstracts away the need to manually define the `sx`, `className` and `slotProps` props in every component.
- Loading branch information
1 parent
92eae2b
commit 1c6694d
Showing
4 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Theme } from "@mui/material/styles"; | ||
import { MUIStyledCommonProps, SxProps } from "@mui/system"; | ||
import React from "react"; | ||
|
||
type SlotProps<Component extends React.ElementType> = Partial<React.ComponentProps<Component>> & MUIStyledCommonProps<Theme>; | ||
|
||
export type ThemedComponentBaseProps<Slots extends Record<string, React.ElementType> = never> = { | ||
sx?: SxProps<Theme>; | ||
className?: string; | ||
slotProps?: { | ||
[K in keyof Slots]?: SlotProps<Slots[K]>; | ||
}; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters