-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e15f32e
commit 0ce81e0
Showing
3 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,8 @@ import clsx from 'clsx'; | |
import { withStyles } from '@material-ui/core/styles'; | ||
|
||
const SPACINGS = { | ||
large: -4, | ||
medium: -8, | ||
small: -16 | ||
large: -4, | ||
small: -16, | ||
}; | ||
|
||
export const styles = theme => ({ | ||
|
@@ -18,11 +17,13 @@ export const styles = theme => ({ | |
/* Styles applied to the avatar elements. */ | ||
avatar: { | ||
border: `2px solid ${theme.palette.background.default}`, | ||
marginLeft: -8, | ||
}, | ||
}); | ||
|
||
const AvatarGroup = React.forwardRef(function AvatarGroup(props, ref) { | ||
const { children: childrenProp, classes, className, spacing, ...other } = props; | ||
const { children: childrenProp, classes, className, spacing = 'medium', ...other } = props; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
oliviertassinari
Author
Member
|
||
|
||
const children = React.Children.toArray(childrenProp).filter(child => { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (isFragment(child)) { | ||
|
@@ -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, | ||
This comment has been minimized.
Sorry, something went wrong.
GFynbo
Contributor
|
||
...child.props.style, | ||
}, | ||
}); | ||
|
@@ -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); |
Also if the “medium” value has been removed from the
SPACINGS
what will the default value refer to?