Skip to content

Commit 6003a64

Browse files
authored
chore: prop adjustment for single character Badges (nodejs#8564)
chore: follow up pr for nodejs#8561
1 parent 84b3316 commit 6003a64

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

packages/ui-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@node-core/ui-components",
3-
"version": "1.5.7",
3+
"version": "1.5.8",
44
"type": "module",
55
"exports": {
66
"./*": [

packages/ui-components/src/Common/Badge/index.stories.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const Medium: Story = {
4949

5050
export const Circular: Story = {
5151
args: {
52-
circular: true,
5352
children: 'D',
5453
size: 'small',
5554
kind: 'error',
@@ -58,7 +57,6 @@ export const Circular: Story = {
5857

5958
export const MediumCircular: Story = {
6059
args: {
61-
circular: true,
6260
children: 'E',
6361
kind: 'warning',
6462
},

packages/ui-components/src/Common/Badge/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ type BadgeSize = 'small' | 'medium';
1010
type BadgeProps = HTMLAttributes<HTMLSpanElement> & {
1111
size?: BadgeSize;
1212
kind?: BadgeKind;
13-
circular?: boolean;
1413
};
1514

1615
const Badge: FC<PropsWithChildren<BadgeProps>> = ({
1716
kind = 'default',
1817
size = 'medium',
19-
circular = false,
2018
className,
2119
children,
2220
...props
@@ -26,7 +24,10 @@ const Badge: FC<PropsWithChildren<BadgeProps>> = ({
2624
styles.badge,
2725
styles[kind],
2826
styles[size],
29-
{ [styles.circular]: circular },
27+
{
28+
[styles.circular]:
29+
typeof children === 'string' && children.length === 1,
30+
},
3031
className
3132
)}
3233
{...props}

0 commit comments

Comments
 (0)