Skip to content

Commit

Permalink
feat(avatar): add status indicator support in avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
anuradha9712 committed Nov 28, 2024
1 parent a99d8cd commit 9d072e5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/components/atoms/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ export const Avatar = (props: AvatarProps) => {
['Avatar-presence--away']: presence === 'away',
});

const statusHintClassName = classNames({
['Avatar-statusHint']: true,
['d-none']: shape !== 'round' || size !== 'regular',
});

const sharedProp = {
size,
firstName,
Expand Down Expand Up @@ -204,6 +209,9 @@ export const Avatar = (props: AvatarProps) => {
renderAvatar()
)}
{presence && <span className={presenceClassNames} />}
<span className={statusHintClassName}>
<Icon name="done" size={12} appearance="white" type="rounded" />
</span>
</span>
);

Expand Down
14 changes: 14 additions & 0 deletions css/src/components/avatar.css
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,17 @@
.Avatar-presence--away {
background: var(--secondary-dark);
}

.Avatar-statusHint {
top: -2px;
right: -2px;
width: 12px;
height: 12px;
border-radius: 50%;
box-shadow: 0 0 0 2px red;
display: flex;
align-items: center;
justify-content: center;
background: green;
position: absolute;
}

0 comments on commit 9d072e5

Please sign in to comment.