-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support passing arrays as Badge children (#1443)
- Loading branch information
Ben Jervis
authored
Feb 9, 2024
1 parent
dd5df91
commit a1433ea
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
'braid-design-system': patch | ||
--- | ||
|
||
--- | ||
updated: | ||
- Badge | ||
--- | ||
|
||
**Badge**: Allow `Badge` to take arrays of values | ||
|
||
Previously, `Badge` only accepted a `string` as children, to prevent the use of other components inside a `Badge`. | ||
|
||
However, when a variable is included with text inside the `Badge`, the children property is interpreted as an array. This prevents a very reasonable use case from being allowed: | ||
|
||
```tsx | ||
<Badge>{jobs.length} Jobs</Badge> | ||
// Error: Type '{ children: string[]; }' is not assignable to type 'BadgeProps'. | ||
``` | ||
|
||
This change allows `Badge` to accept a string, number, or array thereof. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters