-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
[account] New slots and sub-components #4181
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Can we just make it the default behavior and work on more slots in a separate PR? |
2e321ba
to
d76eebf
Compare
Account
docs and make API clearer
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 content slot will by default take a component which takes a session prop
I guess that if we add a useSession
hook this will not be needed?
Everything looks fine here to me but this is without having checked #4227 yet.
Also it seems like the After checking the other PR it seems like this isn't the case so nevermind!content
slot would make some other slots not do anything when used? Not sure if that's something to avoid, but if X for example is using the same kind of logic for some of their slots I guess it's fine.
AccountUserDetails
component and content
slotAccountDetails
component and content
slot
AccountDetails
component and content
slotThere 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've added more comments than usual but in general I think it looks good!
The usage for AccountPreview
and the preview
slot for the condensed/expanded variants seem good to me, as well as the SignOutButton
that can be used.
docs/data/toolpad/core/components/account/AccountCustomLocaleText.js
Outdated
Show resolved
Hide resolved
docs/data/toolpad/core/components/account/AccountSlotsWallet.js
Outdated
Show resolved
Hide resolved
docs/data/toolpad/core/components/account/AccountSlotsWallet.js
Outdated
Show resolved
Hide resolved
Is this a breaking change? |
Yes, since it removes |
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.
Looks great, thanks for addressing the previous comments!
Approving already not to block as I have nothing else that should be a major issue.
About the popover
and popoverContent
slots, not sure if we usually have slots where one wraps / can override the other like that, but I guess that X must have some cases like it too?
So it's probably fine, mentioning it just in case! I guess there's not a much better way to allow full customization there.
|
||
- `<SignInButton />` | ||
- `<AccountPreview />` | ||
- `<Popover />` |
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 is the only one of these 4 components that's actually just a standard Material UI component, right?
Not sure if that can be confusing in any way.
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.
Yes, not sure if I need to clarify that in any way? Perhaps okay to leave it as it is and see if that inspires any confusion
/> | ||
)} | ||
{slots?.popover ? ( | ||
<slots.popover /> |
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.
Should it spread slotProps.popover
in this line too?
}} | ||
> | ||
{slots?.popoverContent ? ( | ||
<slots.popoverContent /> |
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.
Oh and here not sure if it should spread slotProps.popoverContent
too.
|
menuItems
slot topopoverContent
#4179https://deploy-preview-4181--mui-toolpad-docs.netlify.app/toolpad/core/react-account/#customization
https://deploy-preview-4181--mui-toolpad-docs.netlify.app/toolpad/core/api/account-preview/
To Do
slot
structure of the<Account />
component to to havepreview
andpopoverContent
AccountPreview
component withcondensed
andexpanded
variantslocaleContext
between all sub-components to have thelocaleText
prop work onAccount />
without prop drillingBreaking Change
menuItems
slot on theAccount
component and addspopoverContent
instead