Skip to content

Commit 75d6213

Browse files
fix(offerlist): forwards prominence to Badge (#5773)
* fix(offerlist): forwards prominence to Badge * fix: add prominence on badge --------- Co-authored-by: lisa <llupi@scaleway.com>
1 parent abfbe9e commit 75d6213

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.changeset/yummy-games-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ultraviolet/plus": patch
3+
---
4+
5+
`OfferList`: add prop "prominence" for badge

packages/plus/src/components/OfferList/__stories__/Badge.stories.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,28 @@ import type { ComponentProps } from 'react'
33
import { OfferList } from '../OfferList'
44
import { columns, data } from './resources'
55

6+
const getTextBadge = (index: number) => {
7+
if (index === 1) {
8+
return 'I am a primary badge'
9+
}
10+
if (index === 2) {
11+
return 'I am a disabled badge'
12+
}
13+
if (index === 3) {
14+
return 'I am a strong badge '
15+
}
16+
17+
return 'I am a badge'
18+
}
619
export const Badge: StoryFn<ComponentProps<typeof OfferList>> = props => (
720
<OfferList {...props} expandable>
821
{data.map((planet, index) =>
9-
index < 3 ? (
22+
index < 4 ? (
1023
<OfferList.Row
1124
badge={{
25+
prominence: index === 3 ? 'strong' : 'default',
1226
sentiment: index === 1 ? 'primary' : 'neutral',
13-
text: 'I am a badge',
27+
text: getTextBadge(index),
1428
}}
1529
disabled={index === 2}
1630
expandable="Some text"

packages/plus/src/components/OfferList/components/Row.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type RowProps = ComponentProps<typeof List.Row> & {
3838
badge?: {
3939
text: string
4040
sentiment?: ComponentProps<typeof BadgeUV>['sentiment']
41+
prominence?: ComponentProps<typeof BadgeUV>['prominence']
4142
}
4243
style?: CSSProperties
4344
}
@@ -158,6 +159,7 @@ export const Row = ({
158159
<BadgeUV
159160
className={offerListBadge}
160161
disabled={disabled}
162+
prominence={badge.prominence}
161163
sentiment={badge.sentiment}
162164
size="small"
163165
>

0 commit comments

Comments
 (0)