Skip to content

Commit 1733848

Browse files
committed
fix: badge count positioning wrt to other elements in parent
1 parent 4ff79a2 commit 1733848

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

package/src/components/Message/MessageSimple/MessageReplies.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ const useStyles = () => {
221221
alignItems: 'center',
222222
flexDirection: 'row',
223223
gap: primitives.spacingXs,
224-
paddingTop: primitives.spacingXs,
225-
paddingBottom: primitives.spacingXxs,
226224
},
227225
messageRepliesText: {
228226
color: shouldUseOverlayStyles ? semantics.textOnAccent : semantics.textPrimary,

package/src/components/ui/Avatar/AvatarStack.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { UserAvatar } from './UserAvatar';
1010
import { BadgeCount } from '../Badge';
1111

1212
export type AvatarStackProps = {
13-
avatarSize?: 'sm' | 'md' | 'xs';
13+
avatarSize?: 'md' | 'sm' | 'xs';
1414
maxVisible?: number;
1515
items: React.ReactNode[];
1616
overlap?: number;
@@ -26,13 +26,16 @@ export const AvatarStack = (props: AvatarStackProps) => {
2626

2727
const totalWidth = diameter + (visibleItems.length - 1) * visiblePortion;
2828

29+
const badgeCountSize = avatarSize === 'md' ? 'lg' : avatarSize === 'sm' ? 'md' : 'sm';
30+
2931
return (
3032
<View style={styles.wrapper}>
3133
<View
3234
style={[
3335
styles.container,
3436
{
3537
width: totalWidth,
38+
height: diameter,
3639
},
3740
]}
3841
>
@@ -58,15 +61,11 @@ export const AvatarStack = (props: AvatarStackProps) => {
5861
style={[
5962
styles.badgeCount,
6063
{
61-
// This is to ensure the badge is aligned with the last avatar in the stack
6264
marginLeft: -(overlap * diameter),
6365
},
6466
]}
6567
>
66-
<BadgeCount
67-
count={extraCount}
68-
size={avatarSize === 'sm' || avatarSize === 'md' ? 'md' : 'sm'}
69-
/>
68+
<BadgeCount count={extraCount} size={badgeCountSize} />
7069
</View>
7170
)}
7271
</View>
@@ -88,8 +87,8 @@ export const UserAvatarStack = ({
8887
}: UserAvatarStackProps) => {
8988
const items = useMemo(
9089
() =>
91-
users.map((user) => {
92-
return <UserAvatar key={user.id} user={user} size={avatarSize} showBorder />;
90+
users.map((user, index) => {
91+
return <UserAvatar key={`${user.id}-${index}`} user={user} size={avatarSize} showBorder />;
9392
}),
9493
[avatarSize, users],
9594
);

0 commit comments

Comments
 (0)