-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[docs] Add themeable component guide #37908
Conversation
@mnajdova I think the
I think developers should provide just const StatSlot = styled('div', {
name: 'MuiStat',
slot: 'Root',
})(…)
Right now it's kinda confusing why I have to use I think both points won't be a breaking change. cc @DiegoAndai |
@samuelsycamore I put this in the how-to guide, not the customization. What do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice example! Easy to follow and understand 😊🎉
- Regarding
overridesResolver
, what do you propose? if nothing is provided, then the style override slot styles won't be added. Should we default tostyleOverrides[slotName]
? - Regarding the
slot
casing, I agree we could usecamelCase
in this guide so it's the same as the key the users will use. Should we do that from now on in our own codebase?
|
||
Finally, you have to add the Stat component the theme types. | ||
|
||
```ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This example was confusing to me. I didn't understand what each override and change did. I think it would be better if each line is explained with a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will add a comment to it.
I have the same thought. It should default to
We should but we have to update the implementation because some code is checking the upper first letter like |
I agree with both changes proposed by @siriwatknp in the comment above 😊 |
We can make it optional 👍
The |
This looks great! Im looking forward to work using these Apis 🙌 |
@@ -219,7 +233,7 @@ export default function createStyled(input = {}) { | |||
if (process.env.NODE_ENV !== 'production') { | |||
let displayName; | |||
if (componentName) { | |||
displayName = `${componentName}${componentSlot || ''}`; | |||
displayName = `${componentName}${capitalize(componentSlot || '')}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mnajdova based on your comment, I think the logic can be the other way around.
I believe that using slotName directly is easier to understand for developers. The capitalize
I added is to preserve the previous behavior. In fact, it can be removed because it is for debugging and it won't be used in production.
We could remove it in the next major release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep using capitalize
it in the displayName
I have updated:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation looks good. Let's clarify in the TODO which version we are talking about, so that we can search easily. The copy-writing can be reviewed by @samuelsycamore
I'm on it! Thanks for being patient! 🫡 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm so sorry it took me so long to get back to this @siriwatknp !! 😭 I assume that most of my comments here apply to the Material UI doc as well.
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
docs/data/joy/guides/themeable-component/themeable-component.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Sam Sycamore <71297412+samuelsycamore@users.noreply.github.com> Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
…/custom-component
@samuelsycamore all fixed, including Material UI guide. |
I'm late to the party, but this change makes a lot of sense, great to see steps made here 👍 |
Material UI guide: https://deploy-preview-37908--material-ui.netlify.app/material-ui/guides/themeable-component/
Joy UI guide: https://deploy-preview-37908--material-ui.netlify.app/joy-ui/guides/themeable-component/
All of the APIs are public but we've never published the docs. I think it's time to do it. Once the content is stable, I will add the same to Joy UI.
closes #32967
Further improvements in v6 (breaking changes)
The case transforming logic can be removed completely to make the API more intuitive (what you pass in is what you get). Existing usage on Material UI and Joy UI needs to be updated accordingly.