-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
[Avatar] Fix img slot types and add missing slots #45483
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,11 +11,17 @@ | |
| }, | ||
| "sizes": { "type": { "name": "string" } }, | ||
| "slotProps": { | ||
| "type": { "name": "shape", "description": "{ img?: func<br>| object }" }, | ||
| "type": { | ||
| "name": "shape", | ||
| "description": "{ fallback?: func<br>| object, img?: func<br>| object, root?: func<br>| object }" | ||
| }, | ||
| "default": "{}" | ||
| }, | ||
| "slots": { | ||
| "type": { "name": "shape", "description": "{ img?: elementType }" }, | ||
| "type": { | ||
| "name": "shape", | ||
| "description": "{ fallback?: elementType, img?: elementType, root?: elementType }" | ||
| }, | ||
| "default": "{}" | ||
| }, | ||
| "src": { "type": { "name": "string" } }, | ||
|
|
@@ -41,11 +47,23 @@ | |
| "import { Avatar } from '@mui/material';" | ||
| ], | ||
| "slots": [ | ||
| { | ||
| "name": "root", | ||
| "description": "The component that renders the root slot.", | ||
| "default": "'div'", | ||
| "class": "MuiAvatar-root" | ||
| }, | ||
| { | ||
| "name": "img", | ||
| "description": "The component that renders the transition.\n[Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong. |
||
| "default": "Collapse", | ||
| "description": "The component that renders the img slot.", | ||
| "default": "'img'", | ||
| "class": "MuiAvatar-img" | ||
| }, | ||
| { | ||
| "name": "fallback", | ||
| "description": "The component that renders the fallback slot.", | ||
| "default": "Person icon", | ||
| "class": "MuiAvatar-fallback" | ||
| } | ||
| ], | ||
| "classes": [ | ||
|
|
@@ -61,18 +79,6 @@ | |
| "description": "Styles applied to the root element if not `src` or `srcSet`.", | ||
| "isGlobal": false | ||
| }, | ||
| { | ||
| "key": "fallback", | ||
| "className": "MuiAvatar-fallback", | ||
| "description": "Styles applied to the fallback icon", | ||
| "isGlobal": false | ||
| }, | ||
| { | ||
| "key": "root", | ||
| "className": "MuiAvatar-root", | ||
| "description": "Styles applied to the root element.", | ||
| "isGlobal": false | ||
| }, | ||
| { | ||
| "key": "rounded", | ||
| "className": "MuiAvatar-rounded", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,14 @@ describe('<Avatar />', () => { | |
| testDeepOverrides: { slotName: 'fallback', slotClassName: classes.fallback }, | ||
| testVariantProps: { variant: 'foo' }, | ||
| testStateOverrides: { prop: 'variant', value: 'rounded', styleKey: 'rounded' }, | ||
| slots: { | ||
| root: { | ||
| expectedClassName: classes.root, | ||
| }, | ||
| fallback: { | ||
| expectedClassName: classes.fallback, | ||
| }, | ||
| }, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cannot test the |
||
| skip: ['componentsProp'], | ||
| })); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.