Skip to content

Commit 65f6b53

Browse files
JasonVMoCopilot
andauthored
Preserve iOS button color tokens
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a3ce30b commit 65f6b53

3 files changed

Lines changed: 103 additions & 5 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import type { Theme } from '@fluentui-react-native/framework';
2+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
3+
4+
import type { ButtonTokens } from './Button.types';
5+
6+
export const defaultButtonColorTokens: TokenSettings<ButtonTokens, Theme> = (t: Theme) =>
7+
({
8+
backgroundColor: t.colors.buttonBackground,
9+
color: t.colors.buttonText,
10+
borderColor: t.colors.buttonBorder,
11+
iconColor: t.colors.buttonIcon,
12+
disabled: {
13+
backgroundColor: t.colors.defaultDisabledBackground,
14+
color: t.colors.defaultDisabledContent,
15+
borderColor: t.colors.defaultDisabledBorder,
16+
iconColor: t.colors.defaultDisabledIcon,
17+
},
18+
hovered: {
19+
backgroundColor: t.colors.defaultHoveredBackground,
20+
color: t.colors.defaultHoveredContent,
21+
borderColor: t.colors.defaultHoveredBorder,
22+
iconColor: t.colors.defaultHoveredIcon,
23+
},
24+
pressed: {
25+
backgroundColor: t.colors.defaultPressedBackground,
26+
color: t.colors.defaultPressedContent,
27+
borderColor: t.colors.defaultPressedBorder,
28+
iconColor: t.colors.defaultPressedIcon,
29+
},
30+
focused: {
31+
backgroundColor: t.colors.defaultFocusedBackground,
32+
color: t.colors.defaultFocusedContent,
33+
borderColor: t.colors.defaultFocusedBorder,
34+
icon: t.colors.defaultFocusedIcon,
35+
},
36+
primary: {
37+
backgroundColor: t.colors.brandBackground,
38+
color: t.colors.neutralForegroundOnColor,
39+
borderColor: t.colors.brandStroke1,
40+
iconColor: t.colors.neutralForegroundOnColor,
41+
disabled: {
42+
backgroundColor: t.colors.brandBackgroundDisabled,
43+
color: t.colors.neutralForegroundDisabled1,
44+
iconColor: t.colors.neutralForegroundDisabled1,
45+
},
46+
pressed: {
47+
backgroundColor: t.colors.brandBackgroundPressed,
48+
color: t.colors.neutralForegroundOnColor,
49+
iconColor: t.colors.neutralForegroundOnColor,
50+
},
51+
focused: {
52+
backgroundColor: t.colors.brandBackground,
53+
color: t.colors.neutralForegroundOnColor,
54+
borderColor: t.colors.strokeFocus2,
55+
iconColor: t.colors.neutralForegroundOnColor,
56+
},
57+
},
58+
subtle: {
59+
backgroundColor: t.colors.ghostBackground,
60+
color: t.colors.ghostContent,
61+
borderColor: t.colors.ghostBorder,
62+
iconColor: t.colors.ghostIcon,
63+
disabled: {
64+
color: t.colors.ghostDisabledContent,
65+
borderColor: t.colors.ghostDisabledBorder,
66+
backgroundColor: t.colors.ghostDisabledBackground,
67+
iconColor: t.colors.ghostDisabledIcon,
68+
},
69+
hovered: {
70+
backgroundColor: t.colors.ghostHoveredBackground,
71+
color: t.colors.ghostHoveredContent,
72+
borderColor: t.colors.ghostHoveredBorder,
73+
iconColor: t.colors.ghostHoveredIcon,
74+
},
75+
pressed: {
76+
backgroundColor: t.colors.ghostPressedBackground,
77+
borderColor: t.colors.ghostPressedBorder,
78+
color: t.colors.ghostPressedContent,
79+
icon: t.colors.ghostPressedIcon,
80+
},
81+
focused: {
82+
borderColor: t.colors.ghostFocusedBorder,
83+
backgroundColor: t.colors.ghostFocusedBackground,
84+
color: t.colors.ghostFocusedContent,
85+
icon: t.colors.ghostFocusedIcon,
86+
},
87+
},
88+
}) as ButtonTokens;

‎packages/components/Button/src/ToggleButton/__snapshots__/ToggleButton.test.tsx.snap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ exports[`ToggleButton default 1`] = `
6767
numberOfLines={0}
6868
style={
6969
{
70+
"color": "#ffffff",
7071
"fontFamily": "System",
7172
"fontSize": 12,
7273
"fontWeight": "600",

‎packages/components/Button/src/__snapshots__/Button.test.tsx.snap‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ exports[`Button component tests Button circular 1`] = `
6161
numberOfLines={0}
6262
style={
6363
{
64+
"color": "#ffffff",
6465
"fontFamily": "System",
6566
"fontSize": 12,
6667
"fontWeight": "600",
@@ -135,7 +136,7 @@ exports[`Button component tests Button composed 1`] = `
135136
accessible={false}
136137
style={
137138
{
138-
"color": undefined,
139+
"color": "#ffffff",
139140
"dynamicTypeRamp": undefined,
140141
"fontFamily": "System",
141142
"fontSize": 12,
@@ -217,6 +218,7 @@ exports[`Button component tests Button customized 1`] = `
217218
numberOfLines={0}
218219
style={
219220
{
221+
"color": "#ffffff",
220222
"fontFamily": "System",
221223
"fontSize": 12,
222224
"fontWeight": "600",
@@ -293,6 +295,7 @@ exports[`Button component tests Button default 1`] = `
293295
numberOfLines={0}
294296
style={
295297
{
298+
"color": "#ffffff",
296299
"fontFamily": "System",
297300
"fontSize": 12,
298301
"fontWeight": "600",
@@ -348,8 +351,8 @@ exports[`Button component tests Button disabled 1`] = `
348351
{
349352
"alignItems": "center",
350353
"alignSelf": "flex-start",
351-
"backgroundColor": "#e0e0e0",
352-
"borderColor": "#e0e0e0",
354+
"backgroundColor": "#b4d6fa",
355+
"borderColor": "#f3f2f1",
353356
"borderRadius": 8,
354357
"borderWidth": 1,
355358
"display": "flex",
@@ -369,6 +372,7 @@ exports[`Button component tests Button disabled 1`] = `
369372
numberOfLines={0}
370373
style={
371374
{
375+
"color": "#bdbdbd",
372376
"fontFamily": "System",
373377
"fontSize": 12,
374378
"fontWeight": "600",
@@ -446,6 +450,7 @@ exports[`Button component tests Button large 1`] = `
446450
numberOfLines={0}
447451
style={
448452
{
453+
"color": "#ffffff",
449454
"fontFamily": "System",
450455
"fontSize": 13,
451456
"fontWeight": "600",
@@ -523,6 +528,7 @@ exports[`Button component tests Button primary 1`] = `
523528
numberOfLines={0}
524529
style={
525530
{
531+
"color": "#ffffff",
526532
"fontFamily": "System",
527533
"fontSize": 12,
528534
"fontWeight": "600",
@@ -600,6 +606,7 @@ exports[`Button component tests Button small 1`] = `
600606
numberOfLines={0}
601607
style={
602608
{
609+
"color": "#ffffff",
603610
"fontFamily": "System",
604611
"fontSize": 12,
605612
"fontWeight": "600",
@@ -677,6 +684,7 @@ exports[`Button component tests Button square 1`] = `
677684
numberOfLines={0}
678685
style={
679686
{
687+
"color": "#ffffff",
680688
"fontFamily": "System",
681689
"fontSize": 12,
682690
"fontWeight": "600",
@@ -733,7 +741,8 @@ exports[`Button component tests Button subtle 1`] = `
733741
{
734742
"alignItems": "center",
735743
"alignSelf": "flex-start",
736-
"backgroundColor": undefined,
744+
"backgroundColor": "#ffffff",
745+
"borderColor": "#ffffff",
737746
"borderRadius": 8,
738747
"borderWidth": 1,
739748
"display": "flex",
@@ -753,7 +762,7 @@ exports[`Button component tests Button subtle 1`] = `
753762
numberOfLines={0}
754763
style={
755764
{
756-
"color": "#242424",
765+
"color": "#323130",
757766
"fontFamily": "System",
758767
"fontSize": 12,
759768
"fontWeight": "600",

0 commit comments

Comments
 (0)