Skip to content

Commit

Permalink
feat(skeleton): rounded variant
Browse files Browse the repository at this point in the history
  • Loading branch information
soullivaneuh committed Jun 6, 2022
1 parent 32292cb commit 6ca11b9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/data/material/components/skeleton/Variants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default function Variants() {
<Skeleton variant="text" />
<Skeleton variant="circular" width={40} height={40} />
<Skeleton variant="rectangular" width={210} height={118} />
<Skeleton variant="rounded" width={210} height={118} />
</Stack>
);
}
2 changes: 1 addition & 1 deletion docs/data/material/components/skeleton/skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For instance:

## Variants

The component supports 3 shape variants.
The component supports 4 shape variants.

{{"demo": "Variants.js"}}

Expand Down
3 changes: 2 additions & 1 deletion docs/pages/material-ui/api/skeleton.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"variant": {
"type": {
"name": "union",
"description": "'circular'<br>&#124;&nbsp;'rectangular'<br>&#124;&nbsp;'text'<br>&#124;&nbsp;string"
"description": "'circular'<br>&#124;&nbsp;'rectangular'<br>&#124;&nbsp;'rounded'<br>&#124;&nbsp;'text'<br>&#124;&nbsp;string"
},
"default": "'text'"
},
Expand All @@ -32,6 +32,7 @@
"root",
"text",
"rectangular",
"rounded",
"circular",
"pulse",
"wave",
Expand Down
5 changes: 5 additions & 0 deletions docs/translations/api-docs/skeleton/skeleton.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"nodeName": "the root element",
"conditions": "<code>variant=\"rectangular\"</code>"
},
"rounded": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
"conditions": "<code>variant=\"rounded\"</code>"
},
"circular": {
"description": "Styles applied to {{nodeName}} if {{conditions}}.",
"nodeName": "the root element",
Expand Down
2 changes: 1 addition & 1 deletion packages/mui-material/src/Skeleton/Skeleton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface SkeletonTypeMap<P = {}, D extends React.ElementType = 'span'> {
* @default 'text'
*/
variant?: OverridableStringUnion<
'text' | 'rectangular' | 'circular',
'text' | 'rectangular' | 'rounded' | 'circular',
SkeletonPropsVariantOverrides
>;
/**
Expand Down
5 changes: 4 additions & 1 deletion packages/mui-material/src/Skeleton/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ const SkeletonRoot = styled('span', {
...(ownerState.variant === 'circular' && {
borderRadius: '50%',
}),
...(ownerState.variant === 'rounded' && {
borderRadius: theme.shape.borderRadius,
}),
...(ownerState.hasChildren && {
'& > *': {
visibility: 'hidden',
Expand Down Expand Up @@ -230,7 +233,7 @@ Skeleton.propTypes /* remove-proptypes */ = {
* @default 'text'
*/
variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
PropTypes.oneOf(['circular', 'rectangular', 'text']),
PropTypes.oneOf(['circular', 'rectangular', 'rounded', 'text']),
PropTypes.string,
]),
/**
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-material/src/Skeleton/skeletonClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export interface SkeletonClasses {
text: string;
/** Styles applied to the root element if `variant="rectangular"`. */
rectangular: string;
/** Styles applied to the root element if `variant="rounded"`. */
rounded: string;
/** Styles applied to the root element if `variant="circular"`. */
circular: string;
/** Styles applied to the root element if `animation="pulse"`. */
Expand All @@ -31,6 +33,7 @@ const skeletonClasses: SkeletonClasses = generateUtilityClasses('MuiSkeleton', [
'root',
'text',
'rectangular',
'rounded',
'circular',
'pulse',
'wave',
Expand Down

0 comments on commit 6ca11b9

Please sign in to comment.