From 848fc8be1f6f63e64eb8bfa06daf3e5f249ae951 Mon Sep 17 00:00:00 2001 From: Yihui Liao <44729383+yihuiliao@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:52:16 -0800 Subject: [PATCH] fix: update action button to use grid area to position notification badge (#9303) * Revert "Revert "fix: update action button to use grid area to position notification badge (#8409)" (#8552)" This reverts commit 0cdf701003aa586d820221591bba6e137d7db97d. * add chromatic story * fix lint --- .../s2/chromatic/ActionButton.stories.tsx | 14 ++++++++- .../@react-spectrum/s2/src/ActionButton.tsx | 30 ++++++++++++------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/@react-spectrum/s2/chromatic/ActionButton.stories.tsx b/packages/@react-spectrum/s2/chromatic/ActionButton.stories.tsx index 9aa0e2149eb..da80c53f128 100644 --- a/packages/@react-spectrum/s2/chromatic/ActionButton.stories.tsx +++ b/packages/@react-spectrum/s2/chromatic/ActionButton.stories.tsx @@ -10,7 +10,9 @@ * governing permissions and limitations under the License. */ -import {ActionButton, ActionButtonProps, Avatar, Text} from '../src'; +import {ActionButton, ActionButtonProps, Avatar, NotificationBadge, Text} from '../src'; +import BellIcon from '../s2wf-icons/S2_Icon_Bell_20_N.svg'; +import CommentIcon from '../s2wf-icons/S2_Icon_Comment_20_N.svg'; import {Fonts, NotificationBadges, UnsafeClassName} from '../stories/ActionButton.stories'; import {generatePowerset} from '@react-spectrum/story-utils'; import type {Meta, StoryObj} from '@storybook/react'; @@ -100,3 +102,13 @@ export const AvatarOnly: ActionButtonStory = { }; export {Fonts, UnsafeClassName, NotificationBadges}; + +export const NotificationBadgesCustomWidth: ActionButtonStory = { + render: (args) => ( +
+ + + Messages + Notifications +
) +}; diff --git a/packages/@react-spectrum/s2/src/ActionButton.tsx b/packages/@react-spectrum/s2/src/ActionButton.tsx index 9d28e68100f..be70cb4396f 100644 --- a/packages/@react-spectrum/s2/src/ActionButton.tsx +++ b/packages/@react-spectrum/s2/src/ActionButton.tsx @@ -73,7 +73,7 @@ export const btnStyles = style