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

COM-394: Automatically generate className for component slots with createComponentSlot() #1809

Conversation

jamesricky
Copy link
Contributor

@jamesricky jamesricky commented Mar 8, 2024

E.g. the Root slot of MainContent will now alway the className CometAdminMainContent-root.
If the fullHeight prop is set to true, the className CometAdminMainContent-fullHeight also will be added.

This was previously done automatically, when using withStyles() from the legacy @mui/styles package, which was removed during the theming refactor: #1376

This now matches the behavior of Comet-Admin components before the theming refactor and MUI components.

@jamesricky jamesricky self-assigned this Mar 8, 2024
@jamesricky jamesricky changed the base branch from main to feature/refactor-admin-component-theming March 8, 2024 21:46
@jamesricky jamesricky force-pushed the add-class-names-back-to-component-slots branch 3 times, most recently from 1aaa82b to 149b3fa Compare March 11, 2024 10:16
@jamesricky jamesricky force-pushed the add-class-names-back-to-component-slots branch from b17e883 to f50f7d6 Compare March 11, 2024 12:01
@jamesricky jamesricky changed the title COM-394: Add classNames back to component's slots COM-394: Automatically generate className for component slots when using createSlot Mar 11, 2024
@jamesricky jamesricky changed the title COM-394: Automatically generate className for component slots when using createSlot COM-394: Automatically generate className for component slots when using createSlot() Mar 11, 2024
@jamesricky jamesricky changed the title COM-394: Automatically generate className for component slots when using createSlot() COM-394: Automatically generate className for component slots with createSlot() Mar 11, 2024
@jamesricky jamesricky marked this pull request as ready for review March 11, 2024 13:23
@auto-assign auto-assign bot requested a review from johnnyomair March 11, 2024 13:23
@jamesricky
Copy link
Contributor Author

@johnnyomair FYI I'm not really sure how to fix the types in the lines with the @ts-expect-error in createSlot.tsx...

However the usage of the createSlot function infers the types of the base component correctly, e.g. all props of MUIs Paper are available with const MyPaper = createSlot(MuiPaper), all props specific to the a tag are available with createSlot("a") and so on.

@jamesricky jamesricky requested a review from johnnyomair March 14, 2024 10:16
@jamesricky jamesricky changed the title COM-394: Automatically generate className for component slots with createSlot() COM-394: Automatically generate className for component slots with createComponentSlot() Mar 15, 2024
@johnnyomair
Copy link
Collaborator

@johnnyomair FYI I'm not really sure how to fix the types in the lines with the @ts-expect-error in createSlot.tsx...

We should pair on this. I can't determine the errors by reading the code alone. 😁

@jamesricky jamesricky requested a review from johnnyomair March 19, 2024 14:40
@johnnyomair johnnyomair merged commit 3a18e50 into feature/refactor-admin-component-theming Mar 19, 2024
2 checks passed
@johnnyomair johnnyomair deleted the add-class-names-back-to-component-slots branch March 19, 2024 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants