Skip to content

Commit

Permalink
feat(avatars): add hide plus button prop to component
Browse files Browse the repository at this point in the history
  • Loading branch information
Selnapenek committed Jan 25, 2021
1 parent ace2104 commit ac1a5b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/components/Avatars/Avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type AvatarsProps = {
onAvatarsClick?: Function,
onCounterClick?: Function,
onPlusClick?: Function,
withPlusButton?: boolean,
};

const tooltipClassName = css`
Expand All @@ -38,6 +39,7 @@ const Avatars = ({
onAvatarsClick,
onCounterClick,
onPlusClick,
withPlusButton,
...rest
}: AvatarsProps) => {
return (
Expand All @@ -61,9 +63,12 @@ const Avatars = ({
<If condition={ users.length > 4 }>
<AvatarsCounterTag onClick={ onCounterClick } size={ size }>+ { users.length - 4 }</AvatarsCounterTag>
</If>
<AvatarsHandleTag onClick={ onPlusClick } size={ size }>
<Icon name="Plus" size="xs" color="PRIMARY" />
</AvatarsHandleTag>

<If condition={ !!withPlusButton } >
<AvatarsHandleTag onClick={ onPlusClick } size={ size }>
<Icon name="Plus" size="xs" color="PRIMARY" />
</AvatarsHandleTag>
</If>
</AvatarsTag>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/Avatars/Avatars.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default {

export const common = () => (
<Column gap="lg">
<Avatars size="md" users={ USERS } />
<Avatars users={ USERS } />
<Avatars size="md" users={ USERS } withPlusButton />
<Avatars users={ USERS } withPlusButton />
</Column>
);

Expand Down

0 comments on commit ac1a5b6

Please sign in to comment.