Skip to content

Commit

Permalink
fix(Avatar): add missing ref on default avatar (#2516)
Browse files Browse the repository at this point in the history
* fix(Avatar): add missing ref on default avatar

* Create nasty-frogs-end.md
  • Loading branch information
saurabhdaware authored Jan 31, 2025
1 parent 0ca28d0 commit 8b5602b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nasty-frogs-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@razorpay/blade": patch
---

fix(Avatar): misaligned menu on Avatar with icon
2 changes: 1 addition & 1 deletion packages/blade/src/components/Avatar/Avatar.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const _Avatar: React.ForwardRefRenderFunction<BladeElementRef, AvatarProps> = (
);
}

return <AvatarButton {...commonButtonProps} icon={icon ?? UserIcon} />;
return <AvatarButton ref={ref as never} {...commonButtonProps} icon={icon ?? UserIcon} />;
};

const isSquare = variant === 'square';
Expand Down
5 changes: 5 additions & 0 deletions packages/blade/src/components/Menu/docs/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ Default.args = {
trigger: <Avatar name="Saurabh Daware" size="large" color="primary" />,
};

export const WithAvatarIcon = MenuTemplate.bind({});
WithAvatarIcon.args = {
trigger: <Avatar size="large" color="primary" />,
};

export const CustomItems = CustomOverlayMenuTemplate.bind({});
CustomItems.args = {
openInteraction: 'hover',
Expand Down

0 comments on commit 8b5602b

Please sign in to comment.