Skip to content

Commit 9da49b3

Browse files
fix yarn proptypes generation
1 parent e15f32e commit 9da49b3

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

docs/pages/api/avatar-group.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
2626
|:-----|:-----|:--------|:------------|
2727
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The avatars to stack. |
2828
| <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. |
29-
| <span class="prop-name">spacing</span> | <span class="prop-type">'small'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'large'<br>&#124;&nbsp;number</span> | | Defines the spacing between `avatar` as `'large': -4px`, `'medium': -8px`, and `'small': -16px` or define a `number` as the spacing. |
30-
29+
| <span class="prop-name">spacing</span> | <span class="prop-type">'large'<br>&#124;&nbsp;'medium'<br>&#124;&nbsp;'small'<br>&#124;&nbsp;number</span> | | Spacing between avatars. |
3130

3231
The `ref` is forwarded to the root element.
3332

packages/material-ui-lab/src/AvatarGroup/AvatarGroup.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ export interface AvatarGroupProps
1515

1616
export type AvatarGroupClassKey = 'root' | 'avatar';
1717

18-
export default function AvatarGroup(props: AvatarGroupProps): JSX.Element | null;
18+
export default function AvatarGroup(props: AvatarGroupProps): JSX.Element;

packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import clsx from 'clsx';
55
import { withStyles } from '@material-ui/core/styles';
66

77
const SPACINGS = {
8-
large: -4,
9-
medium: -8,
10-
small: -16
8+
large: -4,
9+
medium: -8,
10+
small: -16,
1111
};
1212

1313
export const styles = theme => ({
@@ -18,11 +18,13 @@ export const styles = theme => ({
1818
/* Styles applied to the avatar elements. */
1919
avatar: {
2020
border: `2px solid ${theme.palette.background.default}`,
21+
marginLeft: -8,
2122
},
2223
});
2324

2425
const AvatarGroup = React.forwardRef(function AvatarGroup(props, ref) {
25-
const { children: childrenProp, classes, className, spacing, ...other } = props;
26+
const { children: childrenProp, classes, className, spacing = 'medium', ...other } = props;
27+
2628
const children = React.Children.toArray(childrenProp).filter(child => {
2729
if (process.env.NODE_ENV !== 'production') {
2830
if (isFragment(child)) {
@@ -45,7 +47,8 @@ const AvatarGroup = React.forwardRef(function AvatarGroup(props, ref) {
4547
className: clsx(child.props.className, classes.avatar),
4648
style: {
4749
zIndex: children.length - index,
48-
marginLeft: spacing ? (SPACINGS[spacing] ? SPACINGS[spacing] : spacing) : -8,
50+
marginLeft:
51+
spacing && spacing !== 'medium' && SPACINGS[spacing] ? SPACINGS[spacing] : -spacing,
4952
...child.props.style,
5053
},
5154
});
@@ -68,14 +71,14 @@ AvatarGroup.propTypes = {
6871
* See [CSS API](#css) below for more details.
6972
*/
7073
classes: PropTypes.object,
71-
/**
72-
* Spacing between avatars.
73-
*/
74-
spacing: PropTypes.oneOfType([PropTypes.oneOf(['large', 'medium', 'small']), PropTypes.number]),
7574
/**
7675
* @ignore
7776
*/
7877
className: PropTypes.string,
78+
/**
79+
* Spacing between avatars.
80+
*/
81+
spacing: PropTypes.oneOfType([PropTypes.oneOf(['large', 'medium', 'small']), PropTypes.number]),
7982
};
8083

8184
export default withStyles(styles, { name: 'MuiAvatarGroup' })(AvatarGroup);

0 commit comments

Comments
 (0)