Skip to content

Commit

Permalink
fix yarn proptypes generation
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 18, 2020
1 parent e15f32e commit 8ee426e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/material-ui-lab/src/AvatarGroup/AvatarGroup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export interface AvatarGroupProps

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

export default function AvatarGroup(props: AvatarGroupProps): JSX.Element | null;
export default function AvatarGroup(props: AvatarGroupProps): JSX.Element;
17 changes: 9 additions & 8 deletions packages/material-ui-lab/src/AvatarGroup/AvatarGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import clsx from 'clsx';
import { withStyles } from '@material-ui/core/styles';

const SPACINGS = {
large: -4,
medium: -8,
small: -16
large: -4,
medium: -8,
small: -16,
};

export const styles = theme => ({
Expand All @@ -23,6 +23,7 @@ export const styles = theme => ({

const AvatarGroup = React.forwardRef(function AvatarGroup(props, ref) {
const { children: childrenProp, classes, className, spacing, ...other } = props;

const children = React.Children.toArray(childrenProp).filter(child => {
if (process.env.NODE_ENV !== 'production') {
if (isFragment(child)) {
Expand All @@ -45,7 +46,7 @@ const AvatarGroup = React.forwardRef(function AvatarGroup(props, ref) {
className: clsx(child.props.className, classes.avatar),
style: {
zIndex: children.length - index,
marginLeft: spacing ? (SPACINGS[spacing] ? SPACINGS[spacing] : spacing) : -8,
marginLeft: spacing && SPACINGS[spacing] ? SPACINGS[spacing] : -spacing,
...child.props.style,
},
});
Expand All @@ -68,14 +69,14 @@ AvatarGroup.propTypes = {
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object,
/**
* Spacing between avatars.
*/
spacing: PropTypes.oneOfType([PropTypes.oneOf(['large', 'medium', 'small']), PropTypes.number]),
/**
* @ignore
*/
className: PropTypes.string,
/**
* Spacing between avatars.
*/
spacing: PropTypes.oneOfType([PropTypes.oneOf(['large', 'medium', 'small']), PropTypes.number]),
};

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

0 comments on commit 8ee426e

Please sign in to comment.