Skip to content

Commit 7cf16d7

Browse files
committed
Infra/ migrate button components to design tokens
1 parent 02bead2 commit 7cf16d7

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

demo/src/screens/componentScreens/ActionBarScreen.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ export default class ActionBarScreen extends Component {
1919

2020
render() {
2121
return (
22-
<View flex bg-grey80>
22+
<View flex bg-$backgroundNeutralLight>
2323
<PageControl
2424
containerStyle={[styles.pageControl, styles.absoluteContainer]}
2525
numOfPages={6}
2626
currentPage={this.state.currentPage}
27-
color={Colors.grey10}
27+
color={Colors.$backgroundInverted}
2828
size={15}
2929
/>
3030
<Carousel
@@ -35,7 +35,7 @@ export default class ActionBarScreen extends Component {
3535
<View style={styles.page}>
3636
<ActionBar
3737
actions={[
38-
{label: 'Delete', onPress: () => Alert.alert('delete'), red30: true},
38+
{label: 'Delete', onPress: () => Alert.alert('delete'), $textDangerLight: true},
3939
{label: 'Replace Photo', onPress: () => Alert.alert('replace photo')},
4040
{label: 'Edit', onPress: () => Alert.alert('edit')}
4141
]}
@@ -44,17 +44,17 @@ export default class ActionBarScreen extends Component {
4444

4545
<View style={styles.page}>
4646
<ActionBar
47-
backgroundColor={Colors.primary}
47+
backgroundColor={Colors.$backgroundPrimaryHeavy}
4848
actions={[
49-
{label: 'Hide', onPress: () => Alert.alert('hide'), white: true},
50-
{label: 'Add Discount', onPress: () => Alert.alert('add discount'), white: true},
51-
{label: 'Duplicate', onPress: () => Alert.alert('duplicate'), white: true}
49+
{label: 'Hide', onPress: () => Alert.alert('hide'), $textDefaultLight: true},
50+
{label: 'Add Discount', onPress: () => Alert.alert('add discount'), $textDefaultLight: true},
51+
{label: 'Duplicate', onPress: () => Alert.alert('duplicate'), $textDefaultLight: true}
5252
]}
5353
/>
5454
</View>
5555

5656
<View style={styles.page}>
57-
<ActionBar actions={[{label: 'Delete', red30: true}, {label: 'Edit'}]}/>
57+
<ActionBar actions={[{label: 'Delete', $textDangerLight: true}, {label: 'Edit'}]}/>
5858
</View>
5959

6060
<View style={styles.page}>
@@ -65,9 +65,9 @@ export default class ActionBarScreen extends Component {
6565
<ActionBar
6666
centered
6767
actions={[
68-
{label: 'Bold', labelStyle: {color: Colors.grey10, ...Typography.text60, fontWeight: '400'}},
69-
{label: 'Italic', text60: true, labelStyle: {fontStyle: 'italic', color: Colors.grey10}},
70-
{label: 'Link', text60: true, labelStyle: {textDecorationLine: 'underline', color: Colors.grey10}}
68+
{label: 'Bold', labelStyle: {color: Colors.$textDefault, ...Typography.text60, fontWeight: '400'}},
69+
{label: 'Italic', text60: true, labelStyle: {fontStyle: 'italic', color: Colors.$textDefault}},
70+
{label: 'Link', text60: true, labelStyle: {textDecorationLine: 'underline', color: Colors.$textDefault}}
7171
]}
7272
/>
7373
</View>

demo/src/screens/componentScreens/SegmentedControlScreen.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ const SegmentedControlScreen = () => {
3838
/>
3939
<SegmentedControl
4040
containerStyle={styles.container}
41-
activeColor={Colors.red30}
41+
activeColor={Colors.$textDangerLight}
4242
segments={segments.third}
4343
/>
4444
<SegmentedControl
4545
containerStyle={styles.container}
4646
segments={segments.forth}
47-
activeColor={Colors.grey10}
47+
activeColor={Colors.$textDefault}
4848
borderRadius={BorderRadiuses.br20}
49-
backgroundColor={Colors.grey10}
50-
activeBackgroundColor={Colors.grey40}
51-
inactiveColor={Colors.grey70}
49+
backgroundColor={Colors.$backgroundInverted}
50+
activeBackgroundColor={Colors.$backgroundNeutralIdle}
51+
inactiveColor={Colors.$textDisabled}
5252
/>
5353
</View>
5454
<SegmentedControl

src/components/actionBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ActionBar extends Component<ActionBarProps> {
4848

4949
static defaultProps = {
5050
height: 48,
51-
backgroundColor: Colors.white,
51+
backgroundColor: Colors.$backgroundElevated,
5252
useSafeArea: true
5353
};
5454

@@ -73,7 +73,7 @@ class ActionBar extends Component<ActionBarProps> {
7373
<View row centerV paddingH-20={!centered} style={[this.styles.container, style]} {...others}>
7474
{_.map(actions, (action, i) => (
7575
<View key={i} flex {...this.getAlignment(i)}>
76-
<Button link size={Button.sizes.medium} primary {...action}/>
76+
<Button link size={Button.sizes.medium} $textPrimary {...action}/>
7777
</View>
7878
))}
7979
</View>

src/components/segmentedControl/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ const SegmentedControl = (props: SegmentedControlProps) => {
9292
containerStyle,
9393
style,
9494
segments,
95-
activeColor = Colors.primary,
95+
activeColor = Colors.$textPrimary,
9696
borderRadius = BorderRadiuses.br100,
97-
backgroundColor = Colors.grey80,
98-
activeBackgroundColor = Colors.white,
99-
inactiveColor = Colors.grey20,
97+
backgroundColor = Colors.$backgroundNeutralLight,
98+
activeBackgroundColor = Colors.$backgroundDefault,
99+
inactiveColor = Colors.$textNeutralHeavy,
100100
outlineColor = activeColor,
101101
outlineWidth = BORDER_WIDTH,
102102
throttleTime = 0,
@@ -201,8 +201,8 @@ const SegmentedControl = (props: SegmentedControlProps) => {
201201

202202
const styles = StyleSheet.create({
203203
container: {
204-
backgroundColor: Colors.grey80,
205-
borderColor: Colors.grey60,
204+
backgroundColor: Colors.$backgroundNeutralMedium,
205+
borderColor: Colors.$outlineNeutral,
206206
borderWidth: BORDER_WIDTH
207207
},
208208
selectedSegment: {

src/components/segmentedControl/segment.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export type SegmentProps = SegmentedControlItemProps & {
5757
*/
5858
const Segment = React.memo((props: SegmentProps) => {
5959
const {
60-
activeColor = Colors.primary,
60+
activeColor = Colors.$textPrimary,
6161
label,
6262
iconSource,
6363
iconStyle,

0 commit comments

Comments
 (0)