Skip to content

Commit f4469e4

Browse files
authored
Fix Badge component default settings (#3832)
* Apply filled as default appearance of badge * Fix some other defaults to align with SPEC * Change files * Update snapshots * Change files
1 parent 4490805 commit f4469e4

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Changing size default and fixing appearance default for Badge",
4+
"packageName": "@fluentui-react-native/badge",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/components/Badge/src/Badge.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ export const badgeLookup = (layer: string, userProps: BadgeProps): boolean => {
1919
return (
2020
userProps[layer] ||
2121
layer === userProps['appearance'] ||
22+
(!userProps['appearance'] && layer === 'filled') ||
2223
layer === userProps['size'] ||
23-
(!userProps['size'] && layer === 'large') ||
24+
(!userProps['size'] && layer === 'medium') ||
2425
layer === userProps['shape'] ||
2526
(!userProps['shape'] && layer === 'circular') ||
2627
layer === userProps['badgeColor'] ||
28+
(!userProps['badgeColor'] && layer === 'brand') ||
2729
(I18nManager.isRTL && layer === 'rtl')
2830
);
2931
};

packages/components/Badge/src/__tests__/__snapshots__/Badge.test.tsx.snap

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ exports[`Badge component tests Badge all props 1`] = `
99
"alignItems": "center",
1010
"alignSelf": "flex-start",
1111
"backgroundColor": "#00000000",
12-
"borderColor": "#00000000",
12+
"borderColor": "#185abd",
1313
"borderRadius": 4,
1414
"borderWidth": 1,
1515
"bottom": 0,
@@ -45,7 +45,7 @@ exports[`Badge component tests Badge all props 1`] = `
4545
onAccessibilityTap={[Function]}
4646
style={
4747
{
48-
"color": "#ffffff",
48+
"color": "#185abd",
4949
"fontFamily": "Segoe UI",
5050
"fontSize": 12,
5151
"fontWeight": "400",
@@ -65,15 +65,15 @@ exports[`Badge component tests Badge tokens 1`] = `
6565
{
6666
"alignItems": "center",
6767
"alignSelf": "flex-start",
68-
"backgroundColor": "yellow",
69-
"borderColor": "#f09",
68+
"backgroundColor": "#185abd",
69+
"borderColor": "#00000000",
7070
"borderRadius": 9999,
7171
"borderWidth": 4,
7272
"bottom": 0,
7373
"flexDirection": "row",
7474
"justifyContent": "center",
75-
"minHeight": 24,
76-
"minWidth": 24,
75+
"minHeight": 20,
76+
"minWidth": 20,
7777
"paddingHorizontal": 4,
7878
"position": "relative",
7979
"right": 0,
@@ -90,7 +90,7 @@ exports[`Badge component tests Badge tokens 1`] = `
9090
{
9191
"color": "#ffffff",
9292
"fontFamily": "Segoe UI",
93-
"fontSize": 12,
93+
"fontSize": 10,
9494
"fontWeight": "400",
9595
"margin": 0,
9696
}
@@ -114,8 +114,8 @@ exports[`Badge component tests Empty Badge 1`] = `
114114
"bottom": 0,
115115
"flexDirection": "row",
116116
"justifyContent": "center",
117-
"minHeight": 24,
118-
"minWidth": 24,
117+
"minHeight": 20,
118+
"minWidth": 20,
119119
"paddingHorizontal": 4,
120120
"position": "relative",
121121
"right": 0,
@@ -135,8 +135,8 @@ exports[`Badge component tests Filled badge with shadow 1`] = `
135135
"borderRadius": 9999,
136136
"bottom": 0,
137137
"justifyContent": "center",
138-
"minHeight": 24,
139-
"minWidth": 24,
138+
"minHeight": 20,
139+
"minWidth": 20,
140140
"position": "relative",
141141
"right": 0,
142142
"shadowColor": "#000000",
@@ -161,8 +161,8 @@ exports[`Badge component tests Filled badge with shadow 1`] = `
161161
"borderWidth": 1,
162162
"flexDirection": "row",
163163
"justifyContent": "center",
164-
"minHeight": 24,
165-
"minWidth": 24,
164+
"minHeight": 20,
165+
"minWidth": 20,
166166
"paddingHorizontal": 4,
167167
"position": "relative",
168168
"shadowColor": "#000000",
@@ -184,7 +184,7 @@ exports[`Badge component tests Filled badge with shadow 1`] = `
184184
{
185185
"color": "#ffffff",
186186
"fontFamily": "Segoe UI",
187-
"fontSize": 12,
187+
"fontSize": 10,
188188
"fontWeight": "400",
189189
"margin": 0,
190190
}

0 commit comments

Comments
 (0)