Skip to content

Commit 0151935

Browse files
authored
chore: add notification badge to chromatic (#8068)
* chore: add notification badge to chromatic * fix lint
1 parent 6b0f84b commit 0151935

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

packages/@react-spectrum/s2/chromatic/ActionButton.stories.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
import {ActionButton, Text} from '../src';
14-
import {Fonts, UnsafeClassName} from '../stories/ActionButton.stories';
14+
import {Fonts, NotificationBadges, UnsafeClassName} from '../stories/ActionButton.stories';
1515
import {generatePowerset} from '@react-spectrum/story-utils';
1616
import type {Meta} from '@storybook/react';
1717
import NewIcon from '../s2wf-icons/S2_Icon_New_20_N.svg';
@@ -52,7 +52,7 @@ const Template = (args) => {
5252
let button = <ActionButton key={key} data-testid={fullComboName} {...otherArgs} {...c}>{children ? children : key}</ActionButton>;
5353
if (c.staticColor != null) {
5454
return (
55-
<StaticColorProvider staticColor={c.staticColor}>
55+
<StaticColorProvider key={`static-${key}`} staticColor={c.staticColor}>
5656
{button}
5757
</StaticColorProvider>
5858
);
@@ -82,4 +82,4 @@ export const IconOnly = {
8282
}
8383
};
8484

85-
export {Fonts, UnsafeClassName};
85+
export {Fonts, UnsafeClassName, NotificationBadges};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2025 Adobe. All rights reserved.
3+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License. You may obtain a copy
5+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
6+
*
7+
* Unless required by applicable law or agreed to in writing, software distributed under
8+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9+
* OF ANY KIND, either express or implied. See the License for the specific language
10+
* governing permissions and limitations under the License.
11+
*/
12+
13+
import type {Meta, StoryObj} from '@storybook/react';
14+
import {NotificationBadge} from '../src/NotificationBadge';
15+
import {StaticColorDecorator} from '../stories/utils';
16+
17+
const meta: Meta<typeof NotificationBadge> = {
18+
component: NotificationBadge,
19+
parameters: {
20+
chromaticProvider: {disableAnimations: true}
21+
},
22+
decorators: [StaticColorDecorator],
23+
title: 'S2 Chromatic/NotificationBadge'
24+
};
25+
26+
export default meta;
27+
28+
type Story = StoryObj<typeof NotificationBadge>;
29+
export const Example: Story = {
30+
render: (args) => {
31+
return (
32+
<div style={{display: 'flex', flexWrap: 'wrap', gap: 8, maxWidth: '600px'}}>
33+
<NotificationBadge {...args} />
34+
<NotificationBadge {...args} value={1} />
35+
<NotificationBadge {...args} value={24} />
36+
<NotificationBadge {...args} value={100} />
37+
</div>
38+
);
39+
}
40+
};

0 commit comments

Comments
 (0)