Skip to content

Commit f71384d

Browse files
authored
Dialog - design tokens (#1938)
* Dialog - design tokens * Fix * Fix * Fix
1 parent a088447 commit f71384d

File tree

7 files changed

+25
-23
lines changed

7 files changed

+25
-23
lines changed

demo/src/screens/componentScreens/DialogScreen.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ export default class DialogScreen extends Component {
111111
getWarning = () => {
112112
const {showHeader, scroll, panDirection} = this.state;
113113
if (!showHeader && scroll !== this.SCROLL_TYPE.NONE) {
114-
return <Text color={Colors.red30}>It is recommended to have pannable header with scrollable content</Text>;
114+
return (
115+
<Text color={Colors.$textDangerLight}>It is recommended to have pannable header with scrollable content</Text>
116+
);
115117
} else if (showHeader && panDirection !== PanningProvider.Directions.DOWN) {
116-
return <Text color={Colors.red30}>It is recommended to have pannable header with direction=down</Text>;
118+
return <Text color={Colors.$textDangerLight}>It is recommended to have pannable header with direction=down</Text>;
117119
}
118120
};
119121

@@ -130,7 +132,7 @@ Scroll: ${scroll}`;
130132
return (
131133
<View>
132134
<View margin-20>
133-
<Text>{title}</Text>
135+
<Text $textDefault>{title}</Text>
134136
</View>
135137
<View height={2} bg-grey70/>
136138
</View>
@@ -151,7 +153,7 @@ Scroll: ${scroll}`;
151153

152154
renderVerticalItem = ({item: color}) => {
153155
return (
154-
<Text text50 margin-20 color={color.value}>
156+
<Text $textDefault text50 margin-20 color={color.value}>
155157
{color.label}
156158
</Text>
157159
);
@@ -212,8 +214,8 @@ Scroll: ${scroll}`;
212214
const data = (
213215
<View spread flex={scroll !== this.SCROLL_TYPE.NONE}>
214216
<View marginT-20 marginH-20>
215-
{!showHeader && <Text text50>{this.title}</Text>}
216-
<Text marginT-20={!showHeader}>{this.getMessage()}</Text>
217+
{!showHeader && <Text $textDefault text50>{this.title}</Text>}
218+
<Text $textDefault marginT-20={!showHeader}>{this.getMessage()}</Text>
217219
{this.getWarning()}
218220
</View>
219221
{content}
@@ -260,12 +262,12 @@ Scroll: ${scroll}`;
260262
return (
261263
<ScrollView>
262264
<View flex padding-12>
263-
<Text text30 grey10 marginB-20>
265+
<Text $textDefault text30 marginB-20>
264266
Dialog
265267
</Text>
266268

267269
<RadioGroup marginT-20 initialValue={panDirection} onValueChange={this.setPanDirection}>
268-
<Text>Panning Direction:</Text>
270+
<Text $textDefault>Panning Direction:</Text>
269271
<View row marginV-10>
270272
<RadioButton value={null} label={'None'}/>
271273
<RadioButton value={PanningProvider.Directions.UP} label={'Up'} marginL-10/>
@@ -276,7 +278,7 @@ Scroll: ${scroll}`;
276278
</RadioGroup>
277279

278280
<RadioGroup marginT-20 initialValue={position} onValueChange={this.setPosition}>
279-
<Text>Position:</Text>
281+
<Text $textDefault>Position:</Text>
280282
<View row marginV-10>
281283
<RadioButton value={'top'} label={'Top'}/>
282284
<RadioButton value={null} label={'Center'} marginL-10/>
@@ -285,7 +287,7 @@ Scroll: ${scroll}`;
285287
</RadioGroup>
286288

287289
<RadioGroup marginT-20 initialValue={scroll} onValueChange={this.setScroll}>
288-
<Text>Scroll:</Text>
290+
<Text $textDefault>Scroll:</Text>
289291
<View row marginV-10>
290292
<RadioButton value={this.SCROLL_TYPE.NONE} label={'None'}/>
291293
<RadioButton value={this.SCROLL_TYPE.VERTICAL} label={'Vertical'} marginL-10/>
@@ -294,17 +296,17 @@ Scroll: ${scroll}`;
294296
</RadioGroup>
295297

296298
<View row marginT-20 centerV>
297-
<Text>Toggle pannable header:</Text>
299+
<Text $textDefault>Toggle pannable header:</Text>
298300
<Switch value={showHeader} onValueChange={this.toggleShowHeader} marginL-10/>
299301
</View>
300302

301303
<View row marginT-20 centerV>
302-
<Text>Add some style:</Text>
304+
<Text $textDefault>Add some style:</Text>
303305
<Switch value={isRounded} onValueChange={this.toggleIsRounded} marginL-10/>
304306
</View>
305307

306308
<View row marginT-20 centerV>
307-
<Text>Ignore Background Press:</Text>
309+
<Text $textDefault>Ignore Background Press:</Text>
308310
<Switch value={ignoreBackgroundPress} onValueChange={this.toggleIgnoreBackgroundPress} marginL-10/>
309311
</View>
310312

@@ -319,10 +321,10 @@ Scroll: ${scroll}`;
319321

320322
const styles = StyleSheet.create({
321323
dialog: {
322-
backgroundColor: Colors.white
324+
backgroundColor: Colors.$backgroundDefault
323325
},
324326
roundedDialog: {
325-
backgroundColor: Colors.white,
327+
backgroundColor: Colors.$backgroundDefault,
326328
marginBottom: Constants.isIphoneX ? 0 : 20,
327329
borderRadius: 12
328330
},

demo/src/screens/incubatorScreens/IncubatorDialogScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export default class IncubatorDialogScreen extends Component {
6464
const {visible} = this.state;
6565

6666
return (
67-
<View bg-grey80 flex padding-20>
67+
<View bg-$backgroundNeutralLight flex padding-20>
6868
<Card height={100} center padding-20>
69-
<Text text50>IncubatorDialogScreen</Text>
69+
<Text $textDefault text50>IncubatorDialogScreen</Text>
7070
</Card>
7171
<View flex center>
7272
<Button marginV-s5 label="Open Dialog" onPress={this.openDialog}/>

src/components/dialog/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ interface DialogState {
9191
fadeOut?: boolean;
9292
}
9393

94-
const DEFAULT_OVERLAY_BACKGROUND_COLOR = Colors.rgba(Colors.grey10, 0.6);
94+
const DEFAULT_OVERLAY_BACKGROUND_COLOR = Colors.rgba(Colors.grey20, 0.65);
9595

9696
/**
9797
* @description: Dialog component for displaying custom content inside a popup dialog

src/incubator/Dialog/DialogHeader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const styles = StyleSheet.create({
5353
height: Spacings.s1,
5454
marginTop: Spacings.s2,
5555
marginBottom: Spacings.s2,
56-
backgroundColor: Colors.grey60,
56+
backgroundColor: Colors.$outlineNeutral,
5757
borderRadius: BorderRadiuses.br10
5858
}
5959
});

src/incubator/Dialog/HeaderContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const HeaderContent = (props: Pick<DialogHeaderProps, 'text'>) => {
1212
return (
1313
<View marginH-s5 marginV-s1>
1414
{!isEmpty(title) && (
15-
<Text {...titleProps} marginB-s3 style={titleStyle}>
15+
<Text $textDefault {...titleProps} marginB-s3 style={titleStyle}>
1616
{title}
1717
</Text>
1818
)}
1919
{!isEmpty(subtitle) && (
20-
<Text {...subtitleProps} marginB-s3 style={subtitleStyle}>
20+
<Text $textDefault {...subtitleProps} marginB-s3 style={subtitleStyle}>
2121
{subtitle}
2222
</Text>
2323
)}

src/incubator/Dialog/helpers/useFadeView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {ModalProps} from '../../../components/modal';
77
import {TransitionViewAnimationType} from '../../TransitionView';
88
import {ImperativeDialogProps} from '../types';
99

10-
const DEFAULT_OVERLAY_BACKGROUND_COLORS = Colors.rgba(Colors.black, 0.2);
10+
const DEFAULT_OVERLAY_BACKGROUND_COLORS = Colors.rgba(Colors.grey20, 0.65);
1111

1212
export type AnimationType = TransitionViewAnimationType;
1313

src/incubator/Dialog/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default asBaseComponent<DialogProps>(Dialog);
4545
const styles = StyleSheet.create({
4646
defaultDialogStyle: {
4747
marginBottom: Spacings.s5,
48-
backgroundColor: Colors.white,
48+
backgroundColor: Colors.$backgroundDefault,
4949
maxHeight: Constants.screenHeight * 0.6,
5050
width: 250,
5151
borderRadius: BorderRadiuses.br20,

0 commit comments

Comments
 (0)