Skip to content

Commit bfd335f

Browse files
authored
add owner border to avatar (teambit#3832)
1 parent c8b0671 commit bfd335f

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

scopes/design/ui/Avatar/avatar.compositions.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ export const NoSetIconUserAvatar = () => (
4545
<UserAvatar size={32} account={accounts.noPicUserAccount} />
4646
</ThemeCompositions>
4747
);
48+
49+
export const IsOwnerUserAvatarExample = () => (
50+
<ThemeCompositions>
51+
<UserAvatar size={32} account={accounts.userAccount} isOwner={true} />
52+
</ThemeCompositions>
53+
);

scopes/design/ui/Avatar/styles.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
box-sizing: border-box;
4848
}
4949

50+
.isOwner {
51+
border: 2px solid var(--steel-color);
52+
position: absolute;
53+
width: calc(100% + 4px);
54+
height: calc(100% + 4px);
55+
border-radius: 50%;
56+
}
57+
5058
:export {
5159
//text without hash
5260
defaultAvatarBgColor: str-slice(inspect(var(--border-color)), 2);

scopes/design/ui/Avatar/user-avatar.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,28 @@ type UserAvatarProps = {
1414
fontSize?: number;
1515
className?: string;
1616
imgClassName?: string;
17+
isOwner?: boolean;
1718
};
1819

1920
export class UserAvatar extends PureComponent<UserAvatarProps> {
2021
render() {
21-
const { account, size, imageSize = size, fontSize = Math.round(size * 0.4), className, imgClassName } = this.props;
22+
const {
23+
account,
24+
size,
25+
imageSize = size,
26+
fontSize = Math.round(size * 0.4),
27+
className,
28+
imgClassName,
29+
isOwner = false,
30+
} = this.props;
2231

2332
const { profileImage = '', name = '', displayName = '' } = account;
2433
const firstLetter = name[0] || displayName[0];
2534
const profileImageWithParams = addQueryParams(profileImage, imageSize);
2635
const colors = firstLetter && avatarColors[firstLetter.toLowerCase()];
2736
return (
2837
<div className={classNames(colors, styles.avatar, className)} style={{ width: `${size}px`, height: `${size}px` }}>
38+
{isOwner && <div className={styles.isOwner} />}
2939
{profileImageWithParams && (
3040
<img src={profileImageWithParams} className={classNames(styles.avatarImg, imgClassName)} />
3141
)}

workspace.jsonc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@
6464
"@teambit/base-ui.text.muted-text": "0.6.4",
6565
"@teambit/base-ui.text.paragraph": "0.6.4",
6666
"@teambit/base-ui.text.themed-text": "0.6.4",
67-
"@teambit/base-ui.theme.color-palette": "0.6.3",
68-
"@teambit/base-ui.theme.colors": "0.6.3",
67+
"@teambit/base-ui.theme.color-palette": "0.6.7",
68+
"@teambit/base-ui.theme.colors": "0.6.7",
6969
"@teambit/base-ui.theme.dark-theme": "0.6.3",
70-
"@teambit/base-ui.theme.fonts.roboto": "0.6.2",
71-
"@teambit/base-ui.theme.sizes": "0.6.3",
72-
"@teambit/base-ui.theme.theme-provider": "0.6.4",
70+
"@teambit/base-ui.theme.fonts.roboto": "0.6.7",
71+
"@teambit/base-ui.theme.sizes": "0.6.7",
72+
"@teambit/base-ui.theme.theme-provider": "0.6.7",
7373
"@teambit/base-ui.utils.string.affix": "0.0.2",
7474
"@teambit/base-ui.utils.sub-paths": "0.6.3",
7575
"@teambit/base-ui.utils.time-ago": "0.5.9",
7676
"@teambit/capsule": "0.0.12",
7777
"@teambit/documenter.code.react-playground": "1.0.4",
7878
"@teambit/documenter.routing.external-link": "1.0.3",
79-
"@teambit/documenter.theme.theme-compositions": "2.0.3",
80-
"@teambit/documenter.theme.theme-context": "2.0.2",
79+
"@teambit/documenter.theme.theme-compositions": "3.0.8",
80+
"@teambit/documenter.theme.theme-context": "3.0.8",
8181
"@teambit/documenter.types.docs-file": "1.0.3",
8282
"@teambit/documenter.ui.block-quote": "0.0.1",
8383
"@teambit/documenter.ui.bold": "0.0.1",
@@ -192,7 +192,6 @@
192192
"fuse.js": "6.4.6",
193193
"get-port": "5.1.1",
194194
"globby": "11.0.1",
195-
//TODO: remove this once this is merged https://github.com/isaacs/node-graceful-fs/pull/202
196195
"graceful-fs": "4.2.4",
197196
"graphql-subscriptions": "1.2.0",
198197
"graphql-tag": "2.12.1",
@@ -542,4 +541,4 @@
542541
}
543542
}
544543
}
545-
}
544+
}

0 commit comments

Comments
 (0)