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

[Skeleton] Rename variant circle -> circular and rect -> rectangular for consistency #22053

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/pages/api-docs/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The `MuiSkeleton` name can be used for providing [default props](/customization/
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> | | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'span'</span> | The component used for the root node. Either a string to use a HTML element or a component. |
| <span class="prop-name">height</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Height of the skeleton. Useful when you don't want to adapt the skeleton to a text element but for instance a card. |
| <span class="prop-name">variant</span> | <span class="prop-type">'circle'<br>&#124;&nbsp;'rect'<br>&#124;&nbsp;'text'</span> | <span class="prop-default">'text'</span> | The type of content that will be rendered. |
| <span class="prop-name">variant</span> | <span class="prop-type">'circular'<br>&#124;&nbsp;'rectangular'<br>&#124;&nbsp;'text'</span> | <span class="prop-default">'text'</span> | The type of content that will be rendered. |
| <span class="prop-name">width</span> | <span class="prop-type">number<br>&#124;&nbsp;string</span> | | Width of the skeleton. Useful when the skeleton is inside an inline element with no width of its own. |

The `ref` is forwarded to the root element.
Expand All @@ -46,8 +46,8 @@ Any other props supplied will be provided to the root element (native element).
|:-----|:-------------|:------------|
| <span class="prop-name">root</span> | <span class="prop-name">.MuiSkeleton-root</span> | Styles applied to the root element.
| <span class="prop-name">text</span> | <span class="prop-name">.MuiSkeleton-text</span> | Styles applied to the root element if `variant="text"`.
| <span class="prop-name">rect</span> | <span class="prop-name">.MuiSkeleton-rect</span> | Styles applied to the root element if `variant="rect"`.
| <span class="prop-name">circle</span> | <span class="prop-name">.MuiSkeleton-circle</span> | Styles applied to the root element if `variant="circle"`.
| <span class="prop-name">rectangular</span> | <span class="prop-name">.MuiSkeleton-rectangular</span> | Styles applied to the root element if `variant="rectangular"`.
| <span class="prop-name">circular</span> | <span class="prop-name">.MuiSkeleton-circular</span> | Styles applied to the root element if `variant="circular"`.
| <span class="prop-name">pulse</span> | <span class="prop-name">.MuiSkeleton-pulse</span> | Styles applied to the root element if `animation="pulse"`.
| <span class="prop-name">wave</span> | <span class="prop-name">.MuiSkeleton-wave</span> | Styles applied to the root element if `animation="wave"`.
| <span class="prop-name">withChildren</span> | <span class="prop-name">.MuiSkeleton-withChildren</span> | Styles applied when the component is passed children.
Expand Down
8 changes: 6 additions & 2 deletions docs/src/pages/components/skeleton/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Media(props) {
loading ? (
<Skeleton
animation="wave"
variant="circle"
variant="circular"
width={40}
height={40}
/>
Expand Down Expand Up @@ -71,7 +71,11 @@ function Media(props) {
}
/>
{loading ? (
<Skeleton animation="wave" variant="rect" className={classes.media} />
<Skeleton
animation="wave"
variant="rectangular"
className={classes.media}
/>
) : (
<CardMedia
className={classes.media}
Expand Down
8 changes: 6 additions & 2 deletions docs/src/pages/components/skeleton/Facebook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function Media(props: MediaProps) {
loading ? (
<Skeleton
animation="wave"
variant="circle"
variant="circular"
width={40}
height={40}
/>
Expand Down Expand Up @@ -76,7 +76,11 @@ function Media(props: MediaProps) {
}
/>
{loading ? (
<Skeleton animation="wave" variant="rect" className={classes.media} />
<Skeleton
animation="wave"
variant="rectangular"
className={classes.media}
/>
) : (
<CardMedia
className={classes.media}
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/skeleton/SkeletonChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function SkeletonChildrenDemo(props) {
<Box display="flex" alignItems="center">
<Box margin={1}>
{loading ? (
<Skeleton variant="circle">
<Skeleton variant="circular">
<Avatar />
</Skeleton>
) : (
Expand All @@ -40,7 +40,7 @@ function SkeletonChildrenDemo(props) {
</Box>
</Box>
{loading ? (
<Skeleton variant="rect" width="100%">
<Skeleton variant="rectangular" width="100%">
<div style={{ paddingTop: '57%' }} />
</Skeleton>
) : (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/skeleton/SkeletonChildren.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function SkeletonChildrenDemo(props: { loading?: boolean }) {
<Box display="flex" alignItems="center">
<Box margin={1}>
{loading ? (
<Skeleton variant="circle">
<Skeleton variant="circular">
<Avatar />
</Skeleton>
) : (
Expand All @@ -39,7 +39,7 @@ function SkeletonChildrenDemo(props: { loading?: boolean }) {
</Box>
</Box>
{loading ? (
<Skeleton variant="rect" width="100%">
<Skeleton variant="rectangular" width="100%">
<div style={{ paddingTop: '57%' }} />
</Skeleton>
) : (
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/skeleton/Variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default function Variants() {
return (
<div>
<Skeleton variant="text" />
<Skeleton variant="circle" width={40} height={40} />
<Skeleton variant="rect" width={210} height={118} />
<Skeleton variant="circular" width={40} height={40} />
<Skeleton variant="rectangular" width={210} height={118} />
</div>
);
}
4 changes: 2 additions & 2 deletions docs/src/pages/components/skeleton/Variants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export default function Variants() {
return (
<div>
<Skeleton variant="text" />
<Skeleton variant="circle" width={40} height={40} />
<Skeleton variant="rect" width={210} height={118} />
<Skeleton variant="circular" width={40} height={40} />
<Skeleton variant="rectangular" width={210} height={118} />
</div>
);
}
2 changes: 1 addition & 1 deletion docs/src/pages/components/skeleton/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Media(props) {
src={item.src}
/>
) : (
<Skeleton variant="rect" width={210} height={118} />
<Skeleton variant="rectangular" width={210} height={118} />
)}

{item ? (
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/skeleton/YouTube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function Media(props: MediaProps) {
src={item.src}
/>
) : (
<Skeleton variant="rect" width={210} height={118} />
<Skeleton variant="rectangular" width={210} height={118} />
)}
{item ? (
<Box pr={2}>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/pages/components/skeleton/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For instance:
src={item.src}
/>
) : (
<Skeleton variant="rect" width={210} height={118} />
<Skeleton variant="rectangular" width={210} height={118} />
);
}
```
Expand Down Expand Up @@ -67,7 +67,7 @@ infer its width and height from them.

```jsx
loading ? (
<Skeleton variant="circle">
<Skeleton variant="circular">
<Avatar />
</Skeleton>
) : (
Expand Down
13 changes: 13 additions & 0 deletions docs/src/pages/guides/migration-v4/migration-v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,19 @@ This change affects almost all components where you're using the `component` pro
+<Snackbar anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} />
```

### Skeleton

- Rename `circle` to `circular` and `rect` to `rectangular` for consistency. The possible values should be adjectives, not nouns:

```diff
-<Skeleton variant="circle" />
-<Skeleton variant="rect" />
-<Skeleton classes={{ circle: 'custom-circle-classname', rect: 'custom-rect-classname', }} />
+<Skeleton variant="circular" />
+<Skeleton variant="rectangular" />
-<Skeleton classes={{ circular: 'custom-circle-classname', rectangular: 'custom-rect-classname', }} />
```

### TablePagination

- The customization of the table pagination's actions labels must be done with the `getItemAriaLabel` prop. This increases consistency with the `Pagination` component.
Expand Down
6 changes: 3 additions & 3 deletions packages/material-ui-lab/src/Skeleton/Skeleton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface SkeletonTypeMap<P = {}, D extends React.ElementType = 'span'> {
/**
* The type of content that will be rendered.
*/
variant?: 'text' | 'rect' | 'circle';
variant?: 'text' | 'rectangular' | 'circular';
/**
* Width of the skeleton.
* Useful when the skeleton is inside an inline element with no width of its own.
Expand All @@ -46,8 +46,8 @@ declare const Skeleton: OverridableComponent<SkeletonTypeMap>;
export type SkeletonClassKey =
| 'root'
| 'text'
| 'rect'
| 'circle'
| 'rectangular'
| 'circular'
| 'pulse'
| 'wave'
| 'withChildren'
Expand Down
10 changes: 5 additions & 5 deletions packages/material-ui-lab/src/Skeleton/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const styles = (theme) => ({
content: '"\\00a0"',
},
},
/* Styles applied to the root element if `variant="rect"`. */
rect: {},
/* Styles applied to the root element if `variant="circle"`. */
circle: {
/* Styles applied to the root element if `variant="rectangular"`. */
rectangular: {},
/* Styles applied to the root element if `variant="circular"`. */
circular: {
borderRadius: '50%',
},
/* Styles applied to the root element if `animation="pulse"`. */
Expand Down Expand Up @@ -169,7 +169,7 @@ Skeleton.propTypes = {
/**
* The type of content that will be rendered.
*/
variant: PropTypes.oneOf(['circle', 'rect', 'text']),
variant: PropTypes.oneOf(['circular', 'rectangular', 'text']),
/**
* Width of the skeleton.
* Useful when the skeleton is inside an inline element with no width of its own.
Expand Down
2 changes: 1 addition & 1 deletion test/regressions/tests/Skeleton/SkeletonChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function SkeletonChildren() {
<CssBaseline />
<div style={{ alignItems: 'center', display: 'flex', width: '200px' }}>
<div style={{ margin: '8px' }}>
<Skeleton variant="circle">
<Skeleton variant="circular">
<Avatar />
</Skeleton>
</div>
Expand Down