Skip to content

Commit 30e57e6

Browse files
authored
Hint and Toast - design tokens (#1940)
1 parent f71384d commit 30e57e6

File tree

3 files changed

+27
-32
lines changed

3 files changed

+27
-32
lines changed

demo/src/screens/componentScreens/HintsScreen.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default class HintsScreen extends Component<HintScreenProps> {
4545

4646
renderCustomContent() {
4747
return (
48-
<Text text70 white>
48+
<Text text70 $textDefaultLight>
4949
Click
5050
<Text onPress={() => Alert.alert('custom content :)')} text70BO red40>
5151
{' here '}
@@ -71,17 +71,17 @@ export default class HintsScreen extends Component<HintScreenProps> {
7171
<Incubator.ExpandableOverlay
7272
useDialog
7373
expandableContent={this.renderScreenOptions()}
74-
dialogProps={{bottom: true}}
74+
dialogProps={{bottom: true, useSafeArea: true}}
7575
>
76-
<Button round iconSource={Assets.icons.demo.settings} white/>
76+
<Button round iconSource={Assets.icons.demo.settings} $backgroundDefault/>
7777
</Incubator.ExpandableOverlay>
7878
</View>
7979
);
8080
}
8181

8282
renderScreenOptions() {
8383
return (
84-
<View bg-white br20 padding-20 collapsable={false}>
84+
<View bg-$backgroundDefault br20 padding-20 collapsable={false}>
8585
<Text h2 marginB-s4>
8686
Hint Options
8787
</Text>
@@ -141,14 +141,14 @@ export default class HintsScreen extends Component<HintScreenProps> {
141141
flex
142142
padding-20
143143
paddingT-100
144-
bg-grey80
144+
bg-$backgroundNeutralLight
145145
style={{zIndex: 10}}
146146
key={useTargetFrame ? 'withTargetFrame' : 'withElement'}
147147
>
148148
{/* <Button bg-purple30 label="Background" style={{position: 'absolute', right: 50, bottom: 100}}/> */}
149149
<Hint
150150
visible={showHint}
151-
// color={Colors.orange30}
151+
// color={Colors.$backgroundMajorHeavy}
152152
message={message}
153153
// message={
154154
// <Text>
@@ -170,15 +170,15 @@ export default class HintsScreen extends Component<HintScreenProps> {
170170
// borderRadius={BorderRadiuses.br40}
171171
// edgeMargins={30}
172172
onBackgroundPress={useBackdrop && !useTargetFrame ? this.toggleHint : undefined}
173-
backdropColor={Colors.rgba(Colors.grey10, 0.3)}
173+
backdropColor={Colors.rgba(Colors.$backgroundInverted, 0.3)}
174174
customContent={
175175
showCustomContent
176176
? this.renderCustomContent()
177177
: showReactionStrip
178178
? this.renderReactionStrip()
179179
: undefined
180180
}
181-
color={!showCustomContent && showReactionStrip ? Colors.white : undefined}
181+
color={!showCustomContent && showReactionStrip ? Colors.$backgroundDefault : undefined}
182182
removePaddings={!showCustomContent && showReactionStrip}
183183
enableShadow={enableShadow}
184184
testID={'Hint'}

demo/src/screens/incubatorScreens/IncubatorToastScreen.tsx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ export default class ToastsScreen extends Component {
3232

3333
toggleVisibility = () => {
3434
// Im using this for storing toast visible since setState is async and takes time to response
35-
this.showToast = !this.showToast;
35+
this.showToast = !this.showToast;
3636
this.setState({
3737
visible: this.showToast
3838
});
3939
};
4040

4141
renderCustomContent = () => {
4242
return (
43-
<View flex padding-10 bg-white>
44-
<Text text60>This is a custom content</Text>
45-
<Text>
43+
<View bg-$backgroundNeutralLight flex padding-10>
44+
<Text $textDefault text60>This is a custom content</Text>
45+
<Text $textDefault>
4646
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry
4747
standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to
4848
make a type specimen book.
@@ -54,13 +54,17 @@ export default class ToastsScreen extends Component {
5454
renderAboveToast = () => {
5555
return (
5656
<View flex bottom right paddingB-50 paddingR-20 pointerEvents={'box-none'}>
57-
<Button iconSource={Assets.icons.demo.dashboard} color={Colors.white} style={{height: 50, width: 50}}/>
57+
<Button
58+
iconSource={Assets.icons.demo.dashboard}
59+
color={Colors.$backgroundDefault}
60+
style={{height: 50, width: 50}}
61+
/>
5862
</View>
5963
);
6064
};
6165

6266
renderBelowToast = () => {
63-
return <Text>Attachment below toast</Text>;
67+
return <Text $textDefault>Attachment below toast</Text>;
6468
};
6569

6670
renderAttachment = () => {
@@ -103,10 +107,10 @@ export default class ToastsScreen extends Component {
103107
swipeable={isSwipeable}
104108
onDismiss={this.toggleVisibility}
105109
autoDismiss={3500}
106-
// backgroundColor={Colors.green70}
110+
// backgroundColor={Colors.$backgroundSuccess}
107111
// icon={Assets.icons.demo.add}
108-
// iconColor={Colors.green20}
109-
// style={{borderWidth: 1, borderColor: Colors.grey30}}
112+
// iconColor={Colors.$backgroundSuccessHeavy}
113+
// style={{borderWidth: 1, borderColor: Colors.$outlineNeutralMedium}}
110114
// messageStyle={Typography.text80BO}
111115
>
112116
{isCustomContent ? this.renderCustomContent() : undefined}
@@ -131,11 +135,11 @@ export default class ToastsScreen extends Component {
131135
render() {
132136
return (
133137
<View flex padding-page>
134-
<Text h1 marginB-s4>
138+
<Text $textDefault h1 marginB-s4>
135139
Toast
136140
</Text>
137141

138-
<View flex style={styles.scrollViewContainer}>
142+
<View flex>
139143
<ScrollView contentContainerStyle={styles.scrollView}>
140144
{renderMultipleSegmentOptions.call(this, 'Toast Position', 'toastPosition', [
141145
{label: 'Bottom', value: 'bottom'},
@@ -153,7 +157,7 @@ export default class ToastsScreen extends Component {
153157
{None: '', Label: 'label', Icon: 'icon'},
154158
{isRow: true})}
155159

156-
<Text h3 marginV-s2>
160+
<Text $textDefault h3 marginV-s2>
157161
Presets
158162
</Text>
159163

@@ -177,14 +181,5 @@ export default class ToastsScreen extends Component {
177181
const styles = StyleSheet.create({
178182
scrollView: {
179183
paddingBottom: 80
180-
},
181-
color: {
182-
width: 30,
183-
height: 30,
184-
borderRadius: 15
185-
},
186-
selected: {
187-
borderWidth: 2,
188-
borderColor: Colors.grey10
189184
}
190185
});

src/components/hint/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import TouchableOpacity from '../touchableOpacity';
2626
const sideTip = require('./assets/hintTipSide.png');
2727
const middleTip = require('./assets/hintTipMiddle.png');
2828

29-
const DEFAULT_COLOR = Colors.primary;
29+
const DEFAULT_COLOR = Colors.$backgroundPrimaryHeavy;
3030
const DEFAULT_HINT_OFFSET = Spacings.s4;
3131
const DEFAULT_EDGE_MARGINS = Spacings.s5;
3232

@@ -647,12 +647,12 @@ const styles = StyleSheet.create({
647647
},
648648
hintMessage: {
649649
...Typography.text70,
650-
color: Colors.white,
650+
color: Colors.$textDefaultLight,
651651
flexShrink: 1
652652
},
653653
icon: {
654654
marginRight: Spacings.s4,
655-
tintColor: Colors.white
655+
tintColor: Colors.$backgroundDefault
656656
}
657657
});
658658

0 commit comments

Comments
 (0)