@fluentui-react-native/tester 0.64.11 → 0.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +108 -1
- package/CHANGELOG.md +39 -2
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js +14 -14
- package/lib/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
- package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.d.ts.map +1 -1
- package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.js +49 -40
- package/lib/FluentTester/TestComponents/Avatar/CustomizedAvatar.js.map +1 -1
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.d.ts +3 -0
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.js +95 -0
- package/lib/FluentTester/TestComponents/Notification/NotificationTest.js.map +1 -0
- package/lib/FluentTester/TestComponents/Notification/consts.d.ts +3 -0
- package/lib/FluentTester/TestComponents/Notification/consts.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Notification/consts.js +3 -0
- package/lib/FluentTester/TestComponents/Notification/consts.js.map +1 -0
- package/lib/FluentTester/TestComponents/Notification/index.d.ts +3 -0
- package/lib/FluentTester/TestComponents/Notification/index.d.ts.map +1 -0
- package/lib/FluentTester/TestComponents/Notification/index.js +3 -0
- package/lib/FluentTester/TestComponents/Notification/index.js.map +1 -0
- package/lib/FluentTester/testPages.d.ts.map +1 -1
- package/lib/FluentTester/testPages.ios.d.ts.map +1 -1
- package/lib/FluentTester/testPages.ios.js +6 -0
- package/lib/FluentTester/testPages.ios.js.map +1 -1
- package/lib/FluentTester/testPages.js +6 -0
- package/lib/FluentTester/testPages.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js +14 -14
- package/lib-commonjs/FluentTester/TestComponents/Avatar/BasicAvatar.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.js +48 -39
- package/lib-commonjs/FluentTester/TestComponents/Avatar/CustomizedAvatar.js.map +1 -1
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.d.ts +3 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.js +100 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/NotificationTest.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/consts.d.ts +3 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/consts.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/consts.js +6 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/consts.js.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/index.d.ts +3 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/index.d.ts.map +1 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/index.js +6 -0
- package/lib-commonjs/FluentTester/TestComponents/Notification/index.js.map +1 -0
- package/lib-commonjs/FluentTester/testPages.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/testPages.ios.d.ts.map +1 -1
- package/lib-commonjs/FluentTester/testPages.ios.js +6 -0
- package/lib-commonjs/FluentTester/testPages.ios.js.map +1 -1
- package/lib-commonjs/FluentTester/testPages.js +6 -0
- package/lib-commonjs/FluentTester/testPages.js.map +1 -1
- package/package.json +9 -9
- package/src/FluentTester/TestComponents/Avatar/BasicAvatar.tsx +16 -10
- package/src/FluentTester/TestComponents/Avatar/CustomizedAvatar.tsx +80 -54
- package/src/FluentTester/TestComponents/Notification/NotificationTest.tsx +124 -0
- package/src/FluentTester/TestComponents/Notification/consts.ts +2 -0
- package/src/FluentTester/TestComponents/Notification/index.ts +2 -0
- package/src/FluentTester/testPages.ios.ts +6 -0
- package/src/FluentTester/testPages.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testPages.js","sourceRoot":"","sources":["../../src/FluentTester/testPages.ts"],"names":[],"mappings":";;;AACA,kDAA6E;AAC7E,gDAAmE;AACnE,kDAA6E;AAC7E,sDAAmF;AACnF,gEAA8F;AAC9F,8CAAuE;AACvE,oDAAgF;AAChF,4DAA4F;AAC5F,wDAAsF;AACtF,0DAAyF;AACzF,wDAAsF;AACtF,kDAA6E;AAC7E,oDAAgF;AAChF,4CAAoE;AACpE,8CAAuE;AACvE,gDAA0E;AAC1E,wDAAsF;AACtF,8CAAuE;AACvE,oDAAgF;AAChF,kEAAqG;AACrG,wEAA+G;AAC/G,0DAAyF;AACzF,kDAA2E;AAC3E,sDAAmF;AACnF,8EAAwH;AACxH,sEAA4G;AAC5G,kFAAwH;AACxH,8CAAuE;
|
|
1
|
+
{"version":3,"file":"testPages.js","sourceRoot":"","sources":["../../src/FluentTester/testPages.ts"],"names":[],"mappings":";;;AACA,kDAA6E;AAC7E,gDAAmE;AACnE,kDAA6E;AAC7E,sDAAmF;AACnF,gEAA8F;AAC9F,8CAAuE;AACvE,oDAAgF;AAChF,4DAA4F;AAC5F,wDAAsF;AACtF,0DAAyF;AACzF,wDAAsF;AACtF,kDAA6E;AAC7E,oDAAgF;AAChF,4CAAoE;AACpE,8CAAuE;AACvE,gDAA0E;AAC1E,wDAAsF;AACtF,8CAAuE;AACvE,oDAAgF;AAChF,kEAAqG;AACrG,wEAA+G;AAC/G,0DAAyF;AACzF,kDAA2E;AAC3E,sDAAmF;AACnF,8EAAwH;AACxH,sEAA4G;AAC5G,kFAAwH;AACxH,8CAAuE;AACvE,8DAA+F;AAElF,QAAA,KAAK,GAAsB;IACtC;QACE,IAAI,EAAE,wBAAwB;QAC9B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AE,WAAW;QACjB,SAAS,EAAE,eAAQ;QACnB,QAAQ,EAAE,2BAAoB;KAC/B;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,+BAAgB;QAC3B,QAAQ,EAAE,2CAA4B;KACvC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/tester",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.0",
|
|
4
4
|
"description": "A test app to test FluentUI React Native Components during development",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Microsoft <fluentuinativeowners@microsoft.com>",
|
|
@@ -27,31 +27,31 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@fluentui-react-native/android-theme": ">=0.10.0 <1.0.0",
|
|
29
29
|
"@fluentui-react-native/apple-theme": ">=0.12.3 <1.0.0",
|
|
30
|
-
"@fluentui-react-native/badge": ">=0.0.
|
|
30
|
+
"@fluentui-react-native/badge": ">=0.0.43 <1.0.0",
|
|
31
31
|
"@fluentui-react-native/button": ">=0.22.29 <1.0.0",
|
|
32
32
|
"@fluentui-react-native/default-theme": ">=0.13.0 <1.0.0",
|
|
33
33
|
"@fluentui-react-native/experimental-activity-indicator": ">=0.5.29 <1.0.0",
|
|
34
|
-
"@fluentui-react-native/experimental-avatar": ">=0.14.
|
|
34
|
+
"@fluentui-react-native/experimental-avatar": ">=0.14.44 <1.0.0",
|
|
35
35
|
"@fluentui-react-native/experimental-button": "0.15.30",
|
|
36
|
-
"@fluentui-react-native/experimental-checkbox": "0.11.
|
|
36
|
+
"@fluentui-react-native/experimental-checkbox": "0.11.14",
|
|
37
37
|
"@fluentui-react-native/experimental-drawer": ">=0.1.13 <1.0.0",
|
|
38
|
-
"@fluentui-react-native/experimental-native-date-picker": ">=0.4.
|
|
38
|
+
"@fluentui-react-native/experimental-native-date-picker": ">=0.4.4 <1.0.0",
|
|
39
39
|
"@fluentui-react-native/experimental-expander": "0.3.33",
|
|
40
|
-
"@fluentui-react-native/experimental-menu-button": ">=0.3.
|
|
40
|
+
"@fluentui-react-native/experimental-menu-button": ">=0.3.49 <1.0.0",
|
|
41
41
|
"@fluentui-react-native/experimental-shimmer": "0.6.33",
|
|
42
|
-
"@fluentui-react-native/experimental-tabs": "0.4.
|
|
42
|
+
"@fluentui-react-native/experimental-tabs": "0.4.52",
|
|
43
43
|
"@fluentui-react-native/experimental-text": ">=0.9.0 <1.0.0",
|
|
44
44
|
"@fluentui-react-native/framework": ">=0.7.30 <1.0.0",
|
|
45
45
|
"@fluentui-react-native/icon": "0.12.1",
|
|
46
46
|
"@fluentui-react-native/interactive-hooks": ">=0.16.3 <1.0.0",
|
|
47
|
-
"@fluentui-react-native/menu": ">=0.14.
|
|
47
|
+
"@fluentui-react-native/menu": ">=0.14.8 <1.0.0",
|
|
48
48
|
"@fluentui-react-native/stack": ">=0.6.29 <1.0.0",
|
|
49
49
|
"@fluentui-react-native/theme": ">=0.6.11 <1.0.0",
|
|
50
50
|
"@fluentui-react-native/theme-types": ">=0.17.0 <1.0.0",
|
|
51
51
|
"@fluentui-react-native/themed-stylesheet": "^1.3.3",
|
|
52
52
|
"@fluentui-react-native/theming-utils": ">=0.13.0 <1.0.0",
|
|
53
53
|
"@fluentui-react-native/win32-theme": ">=0.19.0 <1.0.0",
|
|
54
|
-
"@fluentui/react-native": ">=0.30.
|
|
54
|
+
"@fluentui/react-native": ">=0.30.3 <1.0.0",
|
|
55
55
|
"@react-native-community/slider": "^4.2.0",
|
|
56
56
|
"@react-native-menu/menu": "^0.1.2",
|
|
57
57
|
"@react-native-picker/picker": "^2.2.1",
|
|
@@ -41,6 +41,7 @@ const StyledPicker = (props) => {
|
|
|
41
41
|
export const StandardUsage: FunctionComponent = () => {
|
|
42
42
|
const [isSquare, setSquare] = useState(false);
|
|
43
43
|
const [showImage, setShowImage] = useState(true);
|
|
44
|
+
const [outOfOffice, setOutOfOffice] = useState(false);
|
|
44
45
|
const [active, setActive] = useState<AvatarActive>('unset');
|
|
45
46
|
const [activeAppearance, setActiveAppearance] = useState<AvatarActiveAppearance>('ring');
|
|
46
47
|
const [imageSize, setImageSize] = useState<WithUndefined<AvatarSize>>(72);
|
|
@@ -67,7 +68,6 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
67
68
|
src: TestSvg,
|
|
68
69
|
viewBox: '0 0 500 500',
|
|
69
70
|
};
|
|
70
|
-
const iconProps = { svgSource: svgProps, width: 20, height: 20, color: 'red' };
|
|
71
71
|
|
|
72
72
|
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
73
73
|
|
|
@@ -82,6 +82,10 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
82
82
|
<Text style={textStyles}>Set square Avatar</Text>
|
|
83
83
|
<Switch value={isSquare} onValueChange={() => setSquare(!isSquare)} />
|
|
84
84
|
</View>
|
|
85
|
+
<View style={commonStyles.switch}>
|
|
86
|
+
<Text style={textStyles}>Set outOfOffice</Text>
|
|
87
|
+
<Switch value={outOfOffice} onValueChange={() => setOutOfOffice(!outOfOffice)} />
|
|
88
|
+
</View>
|
|
85
89
|
|
|
86
90
|
<StyledPicker prompt="Size" selected={imageSize.toString()} onChange={onSizeChange} collection={avatarSizesForPicker} />
|
|
87
91
|
<StyledPicker prompt="Active" selected={active} onChange={onActiveChange} collection={avatarActive} />
|
|
@@ -96,10 +100,11 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
96
100
|
<StyledPicker prompt="Avatar Color" selected={avatarColor} onChange={onAvatarColorChange} collection={avatarColors} />
|
|
97
101
|
<StyledPicker prompt="Presence status" selected={presence} onChange={onPresenceChange} collection={allPresences} />
|
|
98
102
|
</View>
|
|
99
|
-
<JSAvatar
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
<JSAvatar
|
|
104
|
+
accessibilityLabel="Fall-back Icon"
|
|
105
|
+
accessibilityHint="A picture representing a user"
|
|
106
|
+
size={imageSize === undefinedText ? undefined : imageSize}
|
|
107
|
+
/>
|
|
103
108
|
<JSAvatar
|
|
104
109
|
active={active}
|
|
105
110
|
activeAppearance={activeAppearance}
|
|
@@ -107,7 +112,7 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
107
112
|
name="Satya Nadella"
|
|
108
113
|
shape={isSquare ? 'square' : 'circular'}
|
|
109
114
|
accessibilityLabel="Photo of Satya Nadella"
|
|
110
|
-
badge={{ status: presence === undefinedText ? undefined : presence }}
|
|
115
|
+
badge={{ status: presence === undefinedText ? undefined : presence, outOfOffice }}
|
|
111
116
|
imageUrl={showImage ? satyaPhotoUrl : undefined}
|
|
112
117
|
avatarColor={avatarColor}
|
|
113
118
|
/>
|
|
@@ -118,7 +123,8 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
118
123
|
shape={isSquare ? 'square' : 'circular'}
|
|
119
124
|
accessibilityLabel="Icon"
|
|
120
125
|
name="* Richard Faynman *"
|
|
121
|
-
avatarColor=
|
|
126
|
+
avatarColor="#ff0099"
|
|
127
|
+
initialsColor="yellow"
|
|
122
128
|
/>
|
|
123
129
|
{svgIconsEnabled && (
|
|
124
130
|
<>
|
|
@@ -128,9 +134,9 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
128
134
|
size={imageSize === undefinedText ? undefined : imageSize}
|
|
129
135
|
shape={isSquare ? 'square' : 'circular'}
|
|
130
136
|
accessibilityLabel="SVG Icon"
|
|
131
|
-
icon={
|
|
137
|
+
icon={{ fontSource: { ...fontBuiltInProps, fontSize: 32 }, color: 'red' }}
|
|
132
138
|
avatarColor={avatarColor}
|
|
133
|
-
badge={{ status: 'outOfOffice' }}
|
|
139
|
+
badge={{ status: 'outOfOffice', outOfOffice }}
|
|
134
140
|
/>
|
|
135
141
|
<JSAvatar
|
|
136
142
|
accessibilityHint="A picture representing a user"
|
|
@@ -141,7 +147,7 @@ export const StandardUsage: FunctionComponent = () => {
|
|
|
141
147
|
accessibilityLabel="SVG Icon"
|
|
142
148
|
icon={{ svgSource: svgProps }}
|
|
143
149
|
avatarColor={avatarColor}
|
|
144
|
-
badge={{ status: 'away' }}
|
|
150
|
+
badge={{ status: 'away', outOfOffice }}
|
|
145
151
|
idForColor="15"
|
|
146
152
|
/>
|
|
147
153
|
</>
|
|
@@ -1,57 +1,64 @@
|
|
|
1
1
|
import React, { useState, useMemo } from 'react';
|
|
2
|
-
import { JSAvatar,
|
|
3
|
-
import { Switch, View, Text, TextInput } from 'react-native';
|
|
2
|
+
import { JSAvatar, AvatarSize } from '@fluentui-react-native/experimental-avatar';
|
|
3
|
+
import { Switch, View, Text, TextInput, Platform } from 'react-native';
|
|
4
4
|
import { steveBallmerPhotoUrl } from './../PersonaCoin/styles';
|
|
5
|
-
import { AlignmentPicker } from '../Common/AlignmentPicker';
|
|
6
5
|
import { commonTestStyles as commonStyles } from '../Common/styles';
|
|
7
6
|
import { FontWeight } from '@fluentui-react-native/theme-types';
|
|
7
|
+
import { SvgIconProps } from '@fluentui-react-native/icon';
|
|
8
|
+
import TestSvg from '../../test-data/test.svg';
|
|
8
9
|
|
|
9
10
|
export const CustomizeUsage: React.FunctionComponent = () => {
|
|
10
11
|
const [showImage, setShowImage] = useState(true);
|
|
11
|
-
const [
|
|
12
|
+
const [showInitials, setShowInitials] = useState(true);
|
|
13
|
+
const [avatarColor, setAvatarColor] = useState<string>();
|
|
12
14
|
const [textColor, setTextColor] = useState<string>();
|
|
13
15
|
const [size, setSize] = useState<string>('96');
|
|
14
16
|
const [iconSize, setIconSize] = useState<number>(24);
|
|
17
|
+
const [iconColor, setIconColor] = useState<string>(undefined);
|
|
15
18
|
const [initialsSize, setInitialsSize] = useState<number>(16);
|
|
16
19
|
const [fontWeight, setFontWeight] = useState<string>('normal');
|
|
17
20
|
const [fontFamily, setFontFamily] = useState<string>('Georgia');
|
|
18
|
-
const [horizontalAlignment, setHorizontalAlignment] = useState<IconAlignment>();
|
|
19
|
-
const [verticalAlignment, setVerticalAlignment] = useState<IconAlignment>();
|
|
20
21
|
|
|
21
|
-
const [ringColor, setRingColor] = useState<string>(
|
|
22
|
-
const [ringBackgroundColor, setRingBackgroundColor] = useState<string>(
|
|
22
|
+
const [ringColor, setRingColor] = useState<string>(undefined);
|
|
23
|
+
const [ringBackgroundColor, setRingBackgroundColor] = useState<string>('yellow');
|
|
24
|
+
const [ringThickness, setRingThickness] = useState<string>('4');
|
|
23
25
|
const [showRing, setShowRing] = useState<boolean>(true);
|
|
24
|
-
const [transparent, setTransparent] = useState<boolean>(false);
|
|
25
26
|
|
|
26
27
|
const CustomizedAvatar = useMemo(() => {
|
|
27
28
|
const tokens = {
|
|
28
|
-
|
|
29
|
+
avatarColor,
|
|
29
30
|
color: textColor,
|
|
30
|
-
|
|
31
|
-
verticalIconAlignment: verticalAlignment,
|
|
31
|
+
size: parseInt(size) as AvatarSize,
|
|
32
32
|
iconSize: iconSize,
|
|
33
|
+
iconColor,
|
|
33
34
|
fontSize: initialsSize,
|
|
34
35
|
fontWeight: fontWeight as FontWeight,
|
|
35
36
|
fontFamily,
|
|
36
|
-
size: parseInt(size) as AvatarSize,
|
|
37
37
|
ringColor,
|
|
38
38
|
ringBackgroundColor,
|
|
39
|
+
ringThickness: parseInt(ringThickness),
|
|
39
40
|
};
|
|
40
41
|
return JSAvatar.customize(tokens);
|
|
41
42
|
}, [
|
|
42
|
-
|
|
43
|
+
avatarColor,
|
|
43
44
|
textColor,
|
|
44
|
-
|
|
45
|
-
verticalAlignment,
|
|
45
|
+
iconColor,
|
|
46
46
|
iconSize,
|
|
47
47
|
initialsSize,
|
|
48
48
|
size,
|
|
49
49
|
ringColor,
|
|
50
50
|
ringBackgroundColor,
|
|
51
|
+
ringThickness,
|
|
51
52
|
fontWeight,
|
|
52
53
|
fontFamily,
|
|
53
54
|
]);
|
|
54
55
|
|
|
56
|
+
const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
|
|
57
|
+
const svgProps: SvgIconProps = {
|
|
58
|
+
src: TestSvg,
|
|
59
|
+
viewBox: '0 0 500 500',
|
|
60
|
+
};
|
|
61
|
+
|
|
55
62
|
return (
|
|
56
63
|
<View style={commonStyles.root}>
|
|
57
64
|
<View style={commonStyles.settings}>
|
|
@@ -59,55 +66,53 @@ export const CustomizeUsage: React.FunctionComponent = () => {
|
|
|
59
66
|
<Text>Show image</Text>
|
|
60
67
|
<Switch value={showImage} onValueChange={setShowImage} />
|
|
61
68
|
</View>
|
|
62
|
-
|
|
63
69
|
<View style={commonStyles.switch}>
|
|
64
|
-
<Text>Show
|
|
65
|
-
<Switch value={
|
|
70
|
+
<Text>Show initials</Text>
|
|
71
|
+
<Switch value={showInitials} onValueChange={setShowInitials} />
|
|
66
72
|
</View>
|
|
67
73
|
|
|
68
74
|
<View style={commonStyles.switch}>
|
|
69
|
-
<Text>
|
|
70
|
-
<Switch value={
|
|
75
|
+
<Text>Show rings</Text>
|
|
76
|
+
<Switch value={showRing} onValueChange={setShowRing} />
|
|
71
77
|
</View>
|
|
72
|
-
|
|
73
78
|
<View style={{ flexDirection: 'row' }}>
|
|
74
79
|
<View>
|
|
80
|
+
<Text style={{ fontWeight: 'bold' }}>Avatar tokens</Text>
|
|
75
81
|
<TextInput
|
|
76
82
|
style={[commonStyles.textBox]}
|
|
77
83
|
placeholder="Background color"
|
|
78
84
|
blurOnSubmit={true}
|
|
79
85
|
onSubmitEditing={(e) => {
|
|
80
|
-
|
|
86
|
+
setAvatarColor(e.nativeEvent.text);
|
|
81
87
|
}}
|
|
82
88
|
/>
|
|
83
89
|
|
|
84
90
|
<TextInput
|
|
85
91
|
style={[commonStyles.textBox]}
|
|
86
|
-
placeholder="
|
|
92
|
+
placeholder="Avatar size"
|
|
87
93
|
blurOnSubmit={true}
|
|
88
94
|
onSubmitEditing={(e) => {
|
|
89
|
-
|
|
95
|
+
setSize(e.nativeEvent.text);
|
|
90
96
|
}}
|
|
91
97
|
/>
|
|
92
98
|
|
|
93
99
|
<TextInput
|
|
94
100
|
style={[commonStyles.textBox]}
|
|
95
|
-
placeholder="
|
|
101
|
+
placeholder="Icon size"
|
|
96
102
|
blurOnSubmit={true}
|
|
97
103
|
onSubmitEditing={(e) => {
|
|
98
|
-
|
|
104
|
+
setIconSize(parseInt(e.nativeEvent.text));
|
|
99
105
|
}}
|
|
100
106
|
/>
|
|
101
|
-
|
|
102
107
|
<TextInput
|
|
103
108
|
style={[commonStyles.textBox]}
|
|
104
|
-
placeholder="Icon
|
|
109
|
+
placeholder="Icon color"
|
|
105
110
|
blurOnSubmit={true}
|
|
106
111
|
onSubmitEditing={(e) => {
|
|
107
|
-
|
|
112
|
+
setIconColor(e.nativeEvent.text);
|
|
108
113
|
}}
|
|
109
114
|
/>
|
|
110
|
-
|
|
115
|
+
<Text style={{ fontWeight: 'bold' }}>Ring tokens</Text>
|
|
111
116
|
<TextInput
|
|
112
117
|
style={[commonStyles.textBox]}
|
|
113
118
|
placeholder="Ring background color"
|
|
@@ -116,6 +121,22 @@ export const CustomizeUsage: React.FunctionComponent = () => {
|
|
|
116
121
|
setRingBackgroundColor(e.nativeEvent.text);
|
|
117
122
|
}}
|
|
118
123
|
/>
|
|
124
|
+
<TextInput
|
|
125
|
+
style={[commonStyles.textBox]}
|
|
126
|
+
placeholder="Ring color"
|
|
127
|
+
blurOnSubmit={true}
|
|
128
|
+
onSubmitEditing={(e) => {
|
|
129
|
+
setRingColor(e.nativeEvent.text);
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
<TextInput
|
|
133
|
+
style={[commonStyles.textBox]}
|
|
134
|
+
placeholder="Ring thickness"
|
|
135
|
+
blurOnSubmit={true}
|
|
136
|
+
onSubmitEditing={(e) => {
|
|
137
|
+
setRingThickness(e.nativeEvent.text);
|
|
138
|
+
}}
|
|
139
|
+
/>
|
|
119
140
|
</View>
|
|
120
141
|
<View style={{ paddingHorizontal: 20 }}>
|
|
121
142
|
<Text style={{ fontWeight: 'bold' }}>Font tokens</Text>
|
|
@@ -153,30 +174,35 @@ export const CustomizeUsage: React.FunctionComponent = () => {
|
|
|
153
174
|
/>
|
|
154
175
|
</View>
|
|
155
176
|
</View>
|
|
156
|
-
|
|
157
|
-
<Text>These features will be available later</Text>
|
|
158
|
-
<AlignmentPicker style={commonStyles.header} label="Horizontal icon alignment" onSelectionChange={setHorizontalAlignment} />
|
|
159
|
-
<AlignmentPicker style={commonStyles.header} label="Vertical icon alignment" onSelectionChange={setVerticalAlignment} />
|
|
160
177
|
</View>
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
showRing
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
<View>
|
|
179
|
+
<Text>Customized Avatar</Text>
|
|
180
|
+
<CustomizedAvatar
|
|
181
|
+
active="active"
|
|
182
|
+
activeAppearance="ring"
|
|
183
|
+
avatarColor={avatarColor}
|
|
184
|
+
accessibilityLabel="Former CEO of Microsoft"
|
|
185
|
+
initials={showInitials ? 'SB' : undefined}
|
|
186
|
+
imageUrl={showImage ? steveBallmerPhotoUrl : undefined}
|
|
187
|
+
icon={svgIconsEnabled ? { svgSource: svgProps } : undefined}
|
|
188
|
+
transparentRing={!showRing}
|
|
189
|
+
/>
|
|
190
|
+
</View>
|
|
191
|
+
<View style={{ marginLeft: 20 }}>
|
|
192
|
+
<Text>Avatar customized with props</Text>
|
|
193
|
+
<JSAvatar
|
|
194
|
+
active="active"
|
|
195
|
+
activeAppearance="ring"
|
|
196
|
+
avatarColor={avatarColor}
|
|
197
|
+
accessibilityLabel="Former CEO of Microsoft"
|
|
198
|
+
imageUrl={showImage ? steveBallmerPhotoUrl : undefined}
|
|
199
|
+
ringBackgroundColor={ringBackgroundColor}
|
|
200
|
+
ringColor={ringColor}
|
|
201
|
+
ringThickness={parseInt(ringThickness)}
|
|
202
|
+
size={parseInt(size) as AvatarSize}
|
|
203
|
+
transparentRing={!showRing}
|
|
204
|
+
/>
|
|
205
|
+
</View>
|
|
180
206
|
</View>
|
|
181
207
|
);
|
|
182
208
|
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
3
|
+
import { Test, TestSection, PlatformStatus } from '../Test';
|
|
4
|
+
|
|
5
|
+
const NotificationVariants = ['primary', 'neutral', 'danger', 'warning'] as const;
|
|
6
|
+
type NotificationVariant = typeof NotificationVariants[number];
|
|
7
|
+
|
|
8
|
+
interface NotificationProps {
|
|
9
|
+
/**
|
|
10
|
+
* Notification variants: 'primary' | 'neutral' |'danger' | 'warning'
|
|
11
|
+
*/
|
|
12
|
+
variant: NotificationVariant;
|
|
13
|
+
startText: string;
|
|
14
|
+
endText: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const Notification = (props: NotificationProps) => {
|
|
18
|
+
const variant = props.variant;
|
|
19
|
+
const startText = props.startText;
|
|
20
|
+
const endText = props.endText;
|
|
21
|
+
|
|
22
|
+
let containerBackgroundColor = 'skyblue';
|
|
23
|
+
let foregroundColor = 'black';
|
|
24
|
+
|
|
25
|
+
switch (variant) {
|
|
26
|
+
case 'primary':
|
|
27
|
+
containerBackgroundColor = 'skyblue';
|
|
28
|
+
break;
|
|
29
|
+
case 'neutral':
|
|
30
|
+
containerBackgroundColor = 'lightgrey';
|
|
31
|
+
break;
|
|
32
|
+
case 'danger':
|
|
33
|
+
containerBackgroundColor = 'pink';
|
|
34
|
+
foregroundColor = 'maroon';
|
|
35
|
+
break;
|
|
36
|
+
case 'warning':
|
|
37
|
+
containerBackgroundColor = 'lightyellow';
|
|
38
|
+
foregroundColor = 'brown';
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const styles = StyleSheet.create({
|
|
43
|
+
container: {
|
|
44
|
+
borderRadius: 12,
|
|
45
|
+
backgroundColor: containerBackgroundColor,
|
|
46
|
+
|
|
47
|
+
flex: 1,
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
justifyContent: 'space-between',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
padding: 16,
|
|
52
|
+
},
|
|
53
|
+
start: {
|
|
54
|
+
fontSize: 16,
|
|
55
|
+
color: foregroundColor,
|
|
56
|
+
|
|
57
|
+
flex: 1,
|
|
58
|
+
flexGrow: 1,
|
|
59
|
+
},
|
|
60
|
+
end: {
|
|
61
|
+
fontSize: 16,
|
|
62
|
+
fontWeight: '500',
|
|
63
|
+
color: foregroundColor,
|
|
64
|
+
|
|
65
|
+
marginLeft: 34,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<View style={styles.container}>
|
|
71
|
+
<Text style={styles.start}>{startText}</Text>
|
|
72
|
+
<Text style={styles.end}>{endText}</Text>
|
|
73
|
+
</View>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const PrimaryTest: React.FunctionComponent = () => {
|
|
78
|
+
return <Notification variant={'primary'} startText="Mail Archived" endText="Undo" />;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const NeutralTest: React.FunctionComponent = () => {
|
|
82
|
+
return <Notification variant={'neutral'} startText="Some items require you to sign in to view them" endText="Sign in" />;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const DangerTest: React.FunctionComponent = () => {
|
|
86
|
+
return <Notification variant={'danger'} startText="There was a problem, and your recent changes may not have saved" endText="Retry" />;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const WarningTest: React.FunctionComponent = () => {
|
|
90
|
+
return <Notification variant={'warning'} startText="Read Only" endText="X" />;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const notificationSections: TestSection[] = [
|
|
94
|
+
{
|
|
95
|
+
name: 'Primary',
|
|
96
|
+
component: PrimaryTest,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'Neutral',
|
|
100
|
+
component: NeutralTest,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Danger',
|
|
104
|
+
component: DangerTest,
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'Warning',
|
|
108
|
+
component: WarningTest,
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
|
|
112
|
+
export const NotificationTest: React.FunctionComponent = () => {
|
|
113
|
+
const status: PlatformStatus = {
|
|
114
|
+
win32Status: 'Backlog',
|
|
115
|
+
uwpStatus: 'Backlog',
|
|
116
|
+
iosStatus: 'Beta',
|
|
117
|
+
macosStatus: 'Backlog',
|
|
118
|
+
androidStatus: 'Backlog',
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const description = 'Testing notification component';
|
|
122
|
+
|
|
123
|
+
return <Test name="Notification Test" description={description} sections={notificationSections} status={status}></Test>;
|
|
124
|
+
};
|
|
@@ -19,6 +19,7 @@ import { HOMEPAGE_THEME_BUTTON, ThemeTest } from './TestComponents/Theme';
|
|
|
19
19
|
import { ActivityIndicatorTest, HOMEPAGE_ACTIVITY_INDICATOR_BUTTON } from './TestComponents/ActivityIndicator';
|
|
20
20
|
import { HOMEPAGE_TOKEN_BUTTON, TokenTest } from './TestComponents/Tokens';
|
|
21
21
|
import { HOMEPAGE_EXPERIMENTAL_TEXT_BUTTON, TextExperimentalTest } from './TestComponents/TextExperimental';
|
|
22
|
+
import { HOMEPAGE_NOTIFICATION_BUTTON, NotificationTest } from './TestComponents/Notification';
|
|
22
23
|
|
|
23
24
|
export const tests: TestDescription[] = [
|
|
24
25
|
{
|
|
@@ -121,4 +122,9 @@ export const tests: TestDescription[] = [
|
|
|
121
122
|
component: TokenTest,
|
|
122
123
|
testPage: HOMEPAGE_TOKEN_BUTTON,
|
|
123
124
|
},
|
|
125
|
+
{
|
|
126
|
+
name: 'Notification Test',
|
|
127
|
+
component: NotificationTest,
|
|
128
|
+
testPage: HOMEPAGE_NOTIFICATION_BUTTON,
|
|
129
|
+
},
|
|
124
130
|
];
|
|
@@ -27,6 +27,7 @@ import { HOMEPAGE_CHECKBOX_EXPERIMENTAL_BUTTON, ExperimentalCheckboxTest } from
|
|
|
27
27
|
import { HOMEPAGE_EXPERIMENTAL_TEXT_BUTTON, TextExperimentalTest } from './TestComponents/TextExperimental';
|
|
28
28
|
import { ExperimentalMenuButtonTest, HOMEPAGE_EXPERIMENTAL_MENU_BUTTON } from './TestComponents/MenuButtonExperimental';
|
|
29
29
|
import { MenuTest, HOMEPAGE_MENU_BUTTON } from './TestComponents/Menu';
|
|
30
|
+
import { NotificationTest, HOMEPAGE_NOTIFICATION_BUTTON } from './TestComponents/Notification';
|
|
30
31
|
|
|
31
32
|
export const tests: TestDescription[] = [
|
|
32
33
|
{
|
|
@@ -174,4 +175,9 @@ export const tests: TestDescription[] = [
|
|
|
174
175
|
component: MenuTest,
|
|
175
176
|
testPage: HOMEPAGE_MENU_BUTTON,
|
|
176
177
|
},
|
|
178
|
+
{
|
|
179
|
+
name: 'Notification Test',
|
|
180
|
+
component: NotificationTest,
|
|
181
|
+
testPage: HOMEPAGE_NOTIFICATION_BUTTON,
|
|
182
|
+
},
|
|
177
183
|
];
|