@coorpacademy/components 10.22.1 → 10.22.4
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/es/atom/drag-and-drop/index.js +2 -1
- package/es/atom/drag-and-drop/index.js.map +1 -1
- package/es/atom/header-back-button/index.native.js +74 -0
- package/es/atom/header-back-button/index.native.js.map +1 -0
- package/es/atom/header-back-icon/index.native.js +27 -0
- package/es/atom/header-back-icon/index.native.js.map +1 -0
- package/es/atom/html/index.native.js +153 -0
- package/es/atom/html/index.native.js.map +1 -0
- package/es/atom/input-checkbox/index.js +3 -2
- package/es/atom/input-checkbox/index.js.map +1 -1
- package/es/atom/input-switch/index.js +2 -1
- package/es/atom/input-switch/index.js.map +1 -1
- package/es/atom/select-modal/index.native.js +113 -0
- package/es/atom/select-modal/index.native.js.map +1 -0
- package/es/atom/space/index.native.js +21 -0
- package/es/atom/space/index.native.js.map +1 -0
- package/es/atom/spinner/index.js +1 -0
- package/es/atom/spinner/index.js.map +1 -1
- package/es/atom/text/index.native.js +29 -0
- package/es/atom/text/index.native.js.map +1 -0
- package/es/hoc/modal/index.native.js +97 -0
- package/es/hoc/modal/index.native.js.map +1 -0
- package/es/hoc/modal/select/index.native.js +85 -0
- package/es/hoc/modal/select/index.native.js.map +1 -0
- package/es/hoc/modal/select-item/index.native.js +54 -0
- package/es/hoc/modal/select-item/index.native.js.map +1 -0
- package/es/hoc/touchable/index.native.js +69 -0
- package/es/hoc/touchable/index.native.js.map +1 -0
- package/es/index.js +2 -1
- package/es/index.js.map +1 -1
- package/es/molecule/cm-popin/index.js +27 -8
- package/es/molecule/cm-popin/index.js.map +1 -1
- package/es/molecule/cm-popin/style.css +24 -1
- package/es/molecule/dashboard/battle-request-list/index.js +3 -5
- package/es/molecule/dashboard/battle-request-list/index.js.map +1 -1
- package/es/molecule/dashboard/news-list/index.js +3 -5
- package/es/molecule/dashboard/news-list/index.js.map +1 -1
- package/es/molecule/dashboard/review-banner/index.js +3 -5
- package/es/molecule/dashboard/review-banner/index.js.map +1 -1
- package/es/molecule/dashboard/start-battle/index.js +3 -5
- package/es/molecule/dashboard/start-battle/index.js.map +1 -1
- package/es/molecule/external-content-viewer/index.js +2 -1
- package/es/molecule/external-content-viewer/index.js.map +1 -1
- package/es/molecule/feedback/index.js +7 -3
- package/es/molecule/feedback/index.js.map +1 -1
- package/es/molecule/feedback/style.css +24 -0
- package/es/molecule/questions/free-text/index.native.js +5 -6
- package/es/molecule/questions/free-text/index.native.js.map +1 -1
- package/es/molecule/questions/qcm/index.native.js +6 -3
- package/es/molecule/questions/qcm/index.native.js.map +1 -1
- package/es/molecule/skill-card/prop-types.js +1 -1
- package/es/molecule/skill-card/prop-types.js.map +1 -1
- package/es/template/app-player/loading/index.js +1 -0
- package/es/template/app-player/loading/index.js.map +1 -1
- package/es/template/app-player/player/index.js +6 -3
- package/es/template/app-player/player/index.js.map +1 -1
- package/es/template/app-player/popin-end/index.js +21 -6
- package/es/template/app-player/popin-end/index.js.map +1 -1
- package/es/template/app-player/popin-end/style.css +1 -1
- package/es/template/app-player/popin-end/summary.css +65 -0
- package/es/template/app-player/popin-end/summary.js +57 -7
- package/es/template/app-player/popin-end/summary.js.map +1 -1
- package/es/template/app-player/popin-header/index.js +33 -12
- package/es/template/app-player/popin-header/index.js.map +1 -1
- package/es/template/app-player/popin-header/style.css +93 -0
- package/es/template/app-player/popin-no-access/index.js +27 -0
- package/es/template/app-player/popin-no-access/index.js.map +1 -0
- package/es/template/app-review/demo-ts/index.js +2 -0
- package/es/template/app-review/demo-ts/index.js.map +1 -1
- package/es/template/app-review/demo-ts/index.native.js +9 -0
- package/es/template/app-review/demo-ts/index.native.js.map +1 -0
- package/es/template/app-review/demo-ts/typings.js +7 -0
- package/es/template/app-review/demo-ts/typings.js.map +1 -0
- package/es/template/app-review/index.js +4 -0
- package/es/template/app-review/index.js.map +1 -1
- package/es/template/app-review/index.native.js +3 -13
- package/es/template/app-review/index.native.js.map +1 -1
- package/es/template/app-review/prop-types.js +2 -1
- package/es/template/app-review/prop-types.js.map +1 -1
- package/es/template/app-review/slides/index.js +2 -2
- package/es/template/app-review/slides/index.js.map +1 -1
- package/es/template/app-review/slides/index.native.js +17 -14
- package/es/template/app-review/slides/index.native.js.map +1 -1
- package/es/template/app-review/template-context.js +9 -3
- package/es/template/app-review/template-context.js.map +1 -1
- package/es/types/progression-engine.d.js +2 -0
- package/es/types/progression-engine.d.js.map +1 -0
- package/es/variables/analytics.js.map +1 -1
- package/es/variables/theme.native.js +66 -0
- package/es/variables/theme.native.js.map +1 -0
- package/es/variables/vibration.js +10 -0
- package/es/variables/vibration.js.map +1 -0
- package/lib/atom/drag-and-drop/index.js +2 -1
- package/lib/atom/drag-and-drop/index.js.map +1 -1
- package/lib/atom/header-back-button/index.native.js +95 -0
- package/lib/atom/header-back-button/index.native.js.map +1 -0
- package/lib/atom/header-back-icon/index.native.js +38 -0
- package/lib/atom/header-back-icon/index.native.js.map +1 -0
- package/lib/atom/html/index.native.js +170 -0
- package/lib/atom/html/index.native.js.map +1 -0
- package/lib/atom/input-checkbox/index.js +2 -1
- package/lib/atom/input-checkbox/index.js.map +1 -1
- package/lib/atom/input-switch/index.js +2 -1
- package/lib/atom/input-switch/index.js.map +1 -1
- package/lib/atom/select-modal/index.native.js +135 -0
- package/lib/atom/select-modal/index.native.js.map +1 -0
- package/lib/atom/space/index.native.js +33 -0
- package/lib/atom/space/index.native.js.map +1 -0
- package/lib/atom/spinner/index.js +1 -0
- package/lib/atom/spinner/index.js.map +1 -1
- package/lib/atom/text/index.native.js +44 -0
- package/lib/atom/text/index.native.js.map +1 -0
- package/lib/hoc/modal/index.native.js +114 -0
- package/lib/hoc/modal/index.native.js.map +1 -0
- package/lib/hoc/modal/select/index.native.js +101 -0
- package/lib/hoc/modal/select/index.native.js.map +1 -0
- package/lib/hoc/modal/select-item/index.native.js +70 -0
- package/lib/hoc/modal/select-item/index.native.js.map +1 -0
- package/lib/hoc/touchable/index.native.js +83 -0
- package/lib/hoc/touchable/index.native.js.map +1 -0
- package/lib/index.js +4 -0
- package/lib/index.js.map +1 -1
- package/lib/molecule/cm-popin/index.js +27 -8
- package/lib/molecule/cm-popin/index.js.map +1 -1
- package/lib/molecule/cm-popin/style.css +24 -1
- package/lib/molecule/dashboard/battle-request-list/index.js +3 -5
- package/lib/molecule/dashboard/battle-request-list/index.js.map +1 -1
- package/lib/molecule/dashboard/news-list/index.js +3 -5
- package/lib/molecule/dashboard/news-list/index.js.map +1 -1
- package/lib/molecule/dashboard/review-banner/index.js +3 -5
- package/lib/molecule/dashboard/review-banner/index.js.map +1 -1
- package/lib/molecule/dashboard/start-battle/index.js +3 -5
- package/lib/molecule/dashboard/start-battle/index.js.map +1 -1
- package/lib/molecule/external-content-viewer/index.js +2 -1
- package/lib/molecule/external-content-viewer/index.js.map +1 -1
- package/lib/molecule/feedback/index.js +7 -3
- package/lib/molecule/feedback/index.js.map +1 -1
- package/lib/molecule/feedback/style.css +24 -0
- package/lib/molecule/questions/free-text/index.native.js +5 -6
- package/lib/molecule/questions/free-text/index.native.js.map +1 -1
- package/lib/molecule/questions/qcm/index.native.js +7 -3
- package/lib/molecule/questions/qcm/index.native.js.map +1 -1
- package/lib/molecule/skill-card/prop-types.js +1 -1
- package/lib/molecule/skill-card/prop-types.js.map +1 -1
- package/lib/template/app-player/loading/index.js +1 -0
- package/lib/template/app-player/loading/index.js.map +1 -1
- package/lib/template/app-player/player/index.js +7 -3
- package/lib/template/app-player/player/index.js.map +1 -1
- package/lib/template/app-player/popin-end/index.js +21 -6
- package/lib/template/app-player/popin-end/index.js.map +1 -1
- package/lib/template/app-player/popin-end/style.css +1 -1
- package/lib/template/app-player/popin-end/summary.css +65 -0
- package/lib/template/app-player/popin-end/summary.js +58 -7
- package/lib/template/app-player/popin-end/summary.js.map +1 -1
- package/lib/template/app-player/popin-header/index.js +32 -11
- package/lib/template/app-player/popin-header/index.js.map +1 -1
- package/lib/template/app-player/popin-header/style.css +93 -0
- package/lib/template/app-player/popin-no-access/index.js +37 -0
- package/lib/template/app-player/popin-no-access/index.js.map +1 -0
- package/lib/template/app-review/demo-ts/index.js +3 -0
- package/lib/template/app-review/demo-ts/index.js.map +1 -1
- package/lib/template/app-review/demo-ts/index.native.js +18 -0
- package/lib/template/app-review/demo-ts/index.native.js.map +1 -0
- package/lib/template/app-review/demo-ts/typings.js +16 -0
- package/lib/template/app-review/demo-ts/typings.js.map +1 -0
- package/lib/template/app-review/index.js +5 -0
- package/lib/template/app-review/index.js.map +1 -1
- package/lib/template/app-review/index.native.js +2 -12
- package/lib/template/app-review/index.native.js.map +1 -1
- package/lib/template/app-review/prop-types.js +2 -1
- package/lib/template/app-review/prop-types.js.map +1 -1
- package/lib/template/app-review/slides/index.js +2 -2
- package/lib/template/app-review/slides/index.js.map +1 -1
- package/lib/template/app-review/slides/index.native.js +17 -14
- package/lib/template/app-review/slides/index.native.js.map +1 -1
- package/lib/template/app-review/template-context.js +10 -1
- package/lib/template/app-review/template-context.js.map +1 -1
- package/lib/types/progression-engine.d.js +2 -0
- package/lib/types/progression-engine.d.js.map +1 -0
- package/lib/variables/analytics.js.map +1 -1
- package/lib/variables/theme.native.js +72 -0
- package/lib/variables/theme.native.js.map +1 -0
- package/lib/variables/vibration.js +15 -0
- package/lib/variables/vibration.js.map +1 -0
- package/package.json +9 -3
package/es/atom/spinner/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/atom/spinner/index.js"],"names":["React","spinner","doubleBounce1","doubleBounce2","Spinner"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,aAAjB,EAAgCC,aAAhC,QAAoD,aAApD;;AAEA,MAAMC,OAAO,GAAG,MAAM;AACpB,sBACE;AAAK,IAAA,SAAS,EAAEH;AAAhB,kBACE;AAAK,IAAA,SAAS,EAAEC;AAAhB,IADF,eAEE;AAAK,IAAA,SAAS,EAAEC;AAAhB,IAFF,CADF;AAMD,CAPD;;
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/spinner/index.js"],"names":["React","spinner","doubleBounce1","doubleBounce2","Spinner","propTypes"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAAQC,OAAR,EAAiBC,aAAjB,EAAgCC,aAAhC,QAAoD,aAApD;;AAEA,MAAMC,OAAO,GAAG,MAAM;AACpB,sBACE;AAAK,IAAA,SAAS,EAAEH;AAAhB,kBACE;AAAK,IAAA,SAAS,EAAEC;AAAhB,IADF,eAEE;AAAK,IAAA,SAAS,EAAEC;AAAhB,IAFF,CADF;AAMD,CAPD;;AASAC,OAAO,CAACC,SAAR,2CAAoB,EAApB;AAEA,eAAeD,OAAf","sourcesContent":["import React from 'react';\nimport {spinner, doubleBounce1, doubleBounce2} from './style.css';\n\nconst Spinner = () => {\n return (\n <div className={spinner}>\n <div className={doubleBounce1} />\n <div className={doubleBounce2} />\n </div>\n );\n};\n\nSpinner.propTypes = {};\n\nexport default Spinner;\n"],"file":"index.js"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Text as TextBase, Platform, StyleSheet } from 'react-native';
|
|
5
|
+
export const DEFAULT_STYLE = _extends({}, Platform.select({
|
|
6
|
+
android: {
|
|
7
|
+
fontFamily: 'Roboto'
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
text: _extends({}, DEFAULT_STYLE)
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const Text = props => {
|
|
15
|
+
const {
|
|
16
|
+
children,
|
|
17
|
+
style,
|
|
18
|
+
testID,
|
|
19
|
+
numberOfLines
|
|
20
|
+
} = props;
|
|
21
|
+
return /*#__PURE__*/React.createElement(TextBase, {
|
|
22
|
+
style: [styles.text, style],
|
|
23
|
+
testID: testID,
|
|
24
|
+
numberOfLines: numberOfLines
|
|
25
|
+
}, children);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default Text;
|
|
29
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/atom/text/index.native.tsx"],"names":["React","Text","TextBase","Platform","StyleSheet","DEFAULT_STYLE","select","android","fontFamily","styles","create","text","props","children","style","testID","numberOfLines"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAAQC,IAAI,IAAIC,QAAhB,EAA0BC,QAA1B,EAAoCC,UAApC,QAAgE,cAAhE;AAUA,OAAO,MAAMC,aAAa,gBACrBF,QAAQ,CAACG,MAAT,CAAgB;AACjBC,EAAAA,OAAO,EAAE;AACPC,IAAAA,UAAU,EAAE;AADL;AADQ,CAAhB,CADqB,CAAnB;AAQP,MAAMC,MAAM,GAAGL,UAAU,CAACM,MAAX,CAAkB;AAC/BC,EAAAA,IAAI,eACCN,aADD;AAD2B,CAAlB,CAAf;;AAMA,MAAMJ,IAAI,GAAIW,KAAD,IAAkB;AAC7B,QAAM;AAACC,IAAAA,QAAD;AAAWC,IAAAA,KAAX;AAAkBC,IAAAA,MAAlB;AAA0BC,IAAAA;AAA1B,MAA2CJ,KAAjD;AAEA,sBACE,oBAAC,QAAD;AAAU,IAAA,KAAK,EAAE,CAACH,MAAM,CAACE,IAAR,EAAcG,KAAd,CAAjB;AAAuC,IAAA,MAAM,EAAEC,MAA/C;AAAuD,IAAA,aAAa,EAAEC;AAAtE,KACGH,QADH,CADF;AAKD,CARD;;AAUA,eAAeZ,IAAf","sourcesContent":["import * as React from 'react';\nimport {Text as TextBase, Platform, StyleSheet, ViewStyle} from 'react-native';\n\nexport type Props = {\n // copied from node_modules/react-native/Libraries/Text/TextProps.js\n children: React.ReactNode;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n numberOfLines?: number;\n};\n\nexport const DEFAULT_STYLE = {\n ...Platform.select({\n android: {\n fontFamily: 'Roboto'\n }\n })\n};\n\nconst styles = StyleSheet.create({\n text: {\n ...DEFAULT_STYLE\n }\n});\n\nconst Text = (props: Props) => {\n const {children, style, testID, numberOfLines} = props;\n\n return (\n <TextBase style={[styles.text, style]} testID={testID} numberOfLines={numberOfLines}>\n {children}\n </TextBase>\n );\n};\n\nexport default Text;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
import HeaderBackButton from '../../atom/header-back-button/index.native';
|
|
4
|
+
import { useTemplateContext } from '../../template/app-review/template-context';
|
|
5
|
+
export const HEADER_HEIGHT = 64;
|
|
6
|
+
|
|
7
|
+
const createStyleSheet = theme => StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
borderRadius: theme.radius.card,
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
backgroundColor: theme.colors.white
|
|
12
|
+
},
|
|
13
|
+
header: {
|
|
14
|
+
backgroundColor: theme.colors.white,
|
|
15
|
+
alignItems: 'flex-end',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
paddingHorizontal: theme.spacing.medium,
|
|
18
|
+
height: HEADER_HEIGHT
|
|
19
|
+
},
|
|
20
|
+
content: {
|
|
21
|
+
paddingHorizontal: theme.spacing.medium,
|
|
22
|
+
paddingBottom: theme.spacing.medium,
|
|
23
|
+
alignItems: 'center'
|
|
24
|
+
},
|
|
25
|
+
contentWithHeader: {
|
|
26
|
+
paddingTop: theme.spacing.medium
|
|
27
|
+
},
|
|
28
|
+
contentWithIcon: {
|
|
29
|
+
paddingTop: theme.spacing.small
|
|
30
|
+
},
|
|
31
|
+
icon: {
|
|
32
|
+
marginTop: -HEADER_HEIGHT * (3 / 4),
|
|
33
|
+
padding: 5,
|
|
34
|
+
backgroundColor: theme.colors.white,
|
|
35
|
+
borderRadius: theme.radius.thumbnail,
|
|
36
|
+
alignSelf: 'center'
|
|
37
|
+
},
|
|
38
|
+
iconContent: {
|
|
39
|
+
backgroundColor: theme.colors.white,
|
|
40
|
+
padding: theme.spacing.small,
|
|
41
|
+
borderRadius: theme.radius.thumbnail,
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
alignItems: 'center'
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const Modal = props => {
|
|
48
|
+
const templateContext = useTemplateContext();
|
|
49
|
+
const [styleSheet, setStylesheet] = useState(null);
|
|
50
|
+
const {
|
|
51
|
+
theme
|
|
52
|
+
} = templateContext;
|
|
53
|
+
const {
|
|
54
|
+
children,
|
|
55
|
+
headerBackgroundColor,
|
|
56
|
+
iconBackgroundColor,
|
|
57
|
+
renderIcon,
|
|
58
|
+
contentStyle,
|
|
59
|
+
onClose,
|
|
60
|
+
testID
|
|
61
|
+
} = props;
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const _stylesheet = createStyleSheet(theme);
|
|
64
|
+
|
|
65
|
+
setStylesheet(_stylesheet);
|
|
66
|
+
}, [theme]);
|
|
67
|
+
|
|
68
|
+
if (!styleSheet) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
73
|
+
style: styleSheet.container,
|
|
74
|
+
testID: testID
|
|
75
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
76
|
+
style: [styleSheet.header, {
|
|
77
|
+
backgroundColor: headerBackgroundColor
|
|
78
|
+
}]
|
|
79
|
+
}, /*#__PURE__*/React.createElement(HeaderBackButton, {
|
|
80
|
+
color: theme.colors.gray.dark,
|
|
81
|
+
isFloating: false,
|
|
82
|
+
testID: "close-modal",
|
|
83
|
+
onPress: onClose,
|
|
84
|
+
type: "close"
|
|
85
|
+
})), renderIcon ? /*#__PURE__*/React.createElement(View, {
|
|
86
|
+
style: styleSheet.icon
|
|
87
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
88
|
+
style: [styleSheet.iconContent, {
|
|
89
|
+
backgroundColor: iconBackgroundColor
|
|
90
|
+
}]
|
|
91
|
+
}, renderIcon)) : null, /*#__PURE__*/React.createElement(View, {
|
|
92
|
+
style: [styleSheet.content, headerBackgroundColor && styleSheet.contentWithHeader, renderIcon && styleSheet.contentWithIcon, contentStyle]
|
|
93
|
+
}, children));
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export default Modal;
|
|
97
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hoc/modal/index.native.tsx"],"names":["React","useState","useEffect","StyleSheet","View","HeaderBackButton","useTemplateContext","HEADER_HEIGHT","createStyleSheet","theme","create","container","borderRadius","radius","card","overflow","backgroundColor","colors","white","header","alignItems","justifyContent","paddingHorizontal","spacing","medium","height","content","paddingBottom","contentWithHeader","paddingTop","contentWithIcon","small","icon","marginTop","padding","thumbnail","alignSelf","iconContent","Modal","props","templateContext","styleSheet","setStylesheet","children","headerBackgroundColor","iconBackgroundColor","renderIcon","contentStyle","onClose","testID","_stylesheet","gray","dark"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,QAAyC,OAAzC;AACA,SAAQC,UAAR,EAAoBC,IAApB,QAA0C,cAA1C;AACA,OAAOC,gBAAP,MAA6B,4CAA7B;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AAYA,OAAO,MAAMC,aAAa,GAAG,EAAtB;;AA0CP,MAAMC,gBAAgB,GAAGC,KAAK,IAC5BN,UAAU,CAACO,MAAX,CAAkB;AAChBC,EAAAA,SAAS,EAAE;AACTC,IAAAA,YAAY,EAAEH,KAAK,CAACI,MAAN,CAAaC,IADlB;AAETC,IAAAA,QAAQ,EAAE,QAFD;AAGTC,IAAA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U,CAACJ,WAAZ,EAAyB;AAACrB,MAAAA,eAAe,EAAE6B;AAAlB,KAAzB;AAAb,KACGC,UADH,CADF,CADS,GAMP,IAhBN,eAiBE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLL,UAAU,CAACf,OADN,EAELkB,qBAAqB,IAAIH,UAAU,CAACb,iBAF/B,EAGLkB,UAAU,IAAIL,UAAU,CAACX,eAHpB,EAILiB,YAJK;AADT,KAQGJ,QARH,CAjBF,CADF;AA8BD,CAtDD;;AAwDA,eAAeL,KAAf","sourcesContent":["import React, {useState, useEffect} from 'react';\nimport {StyleSheet, View, ViewStyle} from 'react-native';\nimport HeaderBackButton from '../../atom/header-back-button/index.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\n\nexport type Props = {\n children: React.ReactNode;\n headerBackgroundColor?: string;\n iconBackgroundColor?: string;\n renderIcon?: React.ReactNode;\n contentStyle?: ViewStyle;\n onClose: () => void;\n testID?: string;\n};\n\nexport const HEADER_HEIGHT = 64;\n\ntype StyleSheetType = {\n container: {\n borderRadius: number;\n overflow: string;\n backgroundColor: string;\n };\n header: {\n backgroundColor: string;\n alignItems: string;\n justifyContent: string;\n paddingHorizontal: number;\n height: number;\n };\n content: {\n paddingHorizontal: number;\n paddingBottom: number;\n alignItems: string;\n };\n contentWithHeader: {\n paddingTop: number;\n };\n contentWithIcon: {\n paddingTop: number;\n };\n icon: {\n marginTop: number;\n padding: number;\n backgroundColor: string;\n borderRadius: string;\n alignSelf: string;\n };\n iconContent: {\n backgroundColor: string;\n padding: number;\n borderRadius: number;\n justifyContent: string;\n alignItems: string;\n };\n};\n\nconst createStyleSheet = theme =>\n StyleSheet.create({\n container: {\n borderRadius: theme.radius.card,\n overflow: 'hidden',\n backgroundColor: theme.colors.white\n },\n header: {\n backgroundColor: theme.colors.white,\n alignItems: 'flex-end',\n justifyContent: 'center',\n paddingHorizontal: theme.spacing.medium,\n height: HEADER_HEIGHT\n },\n content: {\n paddingHorizontal: theme.spacing.medium,\n paddingBottom: theme.spacing.medium,\n alignItems: 'center'\n },\n contentWithHeader: {\n paddingTop: theme.spacing.medium\n },\n contentWithIcon: {\n paddingTop: theme.spacing.small\n },\n icon: {\n marginTop: -HEADER_HEIGHT * (3 / 4),\n padding: 5,\n backgroundColor: theme.colors.white,\n borderRadius: theme.radius.thumbnail,\n alignSelf: 'center'\n },\n iconContent: {\n backgroundColor: theme.colors.white,\n padding: theme.spacing.small,\n borderRadius: theme.radius.thumbnail,\n justifyContent: 'center',\n alignItems: 'center'\n }\n });\n\nconst Modal = (props: Props) => {\n const templateContext = useTemplateContext();\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const {theme} = templateContext;\n\n const {\n children,\n headerBackgroundColor,\n iconBackgroundColor,\n renderIcon,\n contentStyle,\n onClose,\n testID\n } = props;\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n return (\n <View style={styleSheet.container} testID={testID}>\n <View style={[styleSheet.header, {backgroundColor: headerBackgroundColor}]}>\n <HeaderBackButton\n color={theme.colors.gray.dark}\n isFloating={false}\n testID=\"close-modal\"\n onPress={onClose}\n type=\"close\"\n />\n </View>\n {renderIcon ? (\n <View style={styleSheet.icon}>\n <View style={[styleSheet.iconContent, {backgroundColor: iconBackgroundColor}]}>\n {renderIcon}\n </View>\n </View>\n ) : null}\n <View\n style={[\n styleSheet.content,\n headerBackgroundColor && styleSheet.contentWithHeader,\n renderIcon && styleSheet.contentWithIcon,\n contentStyle\n ]}\n >\n {children}\n </View>\n </View>\n );\n};\n\nexport default Modal;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import { View, FlatList, StyleSheet } from 'react-native';
|
|
3
|
+
import { useTemplateContext } from '../../../template/app-review/template-context';
|
|
4
|
+
import Modal from '../index.native';
|
|
5
|
+
import ModalSelectItem from '../select-item/index.native';
|
|
6
|
+
|
|
7
|
+
const createStyleSheet = theme => StyleSheet.create({
|
|
8
|
+
content: {
|
|
9
|
+
paddingHorizontal: 0
|
|
10
|
+
},
|
|
11
|
+
separator: {
|
|
12
|
+
borderTopWidth: 1,
|
|
13
|
+
borderColor: theme.colors.border
|
|
14
|
+
},
|
|
15
|
+
list: {
|
|
16
|
+
width: '100%'
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const keyExtractor = (item, index) => {
|
|
21
|
+
return `modal-select-item-${index + 1}`;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const createRenderItem = (value, testID, onChange) => ({
|
|
25
|
+
item,
|
|
26
|
+
index
|
|
27
|
+
}) => {
|
|
28
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping
|
|
29
|
+
const handleChange = _value => () => onChange(_value);
|
|
30
|
+
|
|
31
|
+
return /*#__PURE__*/React.createElement(ModalSelectItem, {
|
|
32
|
+
onPress: handleChange(item.text),
|
|
33
|
+
isSelected: value === item.text,
|
|
34
|
+
testID: `${testID}-item-${index + 1}`
|
|
35
|
+
}, item.text);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const createSeparator = styleSheet => () => {
|
|
39
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
40
|
+
style: styleSheet?.separator
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const ModalSelect = props => {
|
|
45
|
+
const templateContext = useTemplateContext();
|
|
46
|
+
const [styleSheet, setStylesheet] = useState(null);
|
|
47
|
+
const {
|
|
48
|
+
theme
|
|
49
|
+
} = templateContext;
|
|
50
|
+
const {
|
|
51
|
+
value,
|
|
52
|
+
values,
|
|
53
|
+
onChange,
|
|
54
|
+
onClose,
|
|
55
|
+
testID = 'modal-select'
|
|
56
|
+
} = props;
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const _stylesheet = createStyleSheet(theme);
|
|
59
|
+
|
|
60
|
+
setStylesheet(_stylesheet);
|
|
61
|
+
}, [theme]);
|
|
62
|
+
const renderItem = useMemo(() => createRenderItem(value, testID, onChange), [value, testID, onChange]);
|
|
63
|
+
const renderSeparator = useMemo(() => createSeparator(styleSheet), [styleSheet]);
|
|
64
|
+
|
|
65
|
+
if (!styleSheet) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
70
|
+
onClose: onClose,
|
|
71
|
+
contentStyle: styleSheet?.content,
|
|
72
|
+
testID: testID
|
|
73
|
+
}, /*#__PURE__*/React.createElement(FlatList, {
|
|
74
|
+
data: values,
|
|
75
|
+
renderItem: renderItem,
|
|
76
|
+
keyExtractor: keyExtractor,
|
|
77
|
+
showsVerticalScrollIndicator: false,
|
|
78
|
+
ItemSeparatorComponent: renderSeparator,
|
|
79
|
+
style: styleSheet?.list,
|
|
80
|
+
testID: `${testID}-items`
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default ModalSelect;
|
|
85
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hoc/modal/select/index.native.tsx"],"names":["React","useState","useEffect","useMemo","View","FlatList","StyleSheet","useTemplateContext","Modal","ModalSelectItem","createStyleSheet","theme","create","content","paddingHorizontal","separator","borderTopWidth","borderColor","colors","border","list","width","keyExtractor","item","index","createRenderItem","value","testID","onChange","handleChange","_value","text","createSeparator","styleSheet","ModalSelect","props","templateContext","setStylesheet","values","onClose","_stylesheet","renderItem","renderSeparator"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,EAAoCC,OAApC,QAAkD,OAAlD;AACA,SAAQC,IAAR,EAAcC,QAAd,EAAwBC,UAAxB,QAAyC,cAAzC;AAIA,SAAQC,kBAAR,QAAiC,+CAAjC;AAEA,OAAOC,KAAP,MAAkB,iBAAlB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FlatList, StyleSheet} from 'react-native';\nimport type {Choice} from '../../../types/progression-engine.d';\n\nimport {Theme} from '../../../variables/theme.native';\nimport {useTemplateContext} from '../../../template/app-review/template-context';\n\nimport Modal from '../index.native';\nimport ModalSelectItem from '../select-item/index.native';\n\ntype ChoiceValue = Pick<Choice, 'value'>;\ntype ChoiceItem = Pick<Choice, 'items'>;\nexport type OnChangeFunction = (value: ChoiceValue) => void;\n\nexport type Props = {\n value?: ChoiceValue;\n values: Array<ChoiceItem>;\n onChange: OnChangeFunction;\n onClose?: () => void;\n testID?: string;\n};\n\ntype StyleSheetType = {\n content: {\n paddingHorizontal: number;\n };\n separator: {\n borderTopWidth: number;\n borderColor: string;\n };\n list: {\n width: string;\n };\n};\n\nconst createStyleSheet = (theme: Theme) =>\n StyleSheet.create({\n content: {\n paddingHorizontal: 0\n },\n separator: {\n borderTopWidth: 1,\n borderColor: theme.colors.border\n },\n list: {\n width: '100%'\n }\n });\n\nconst keyExtractor = (item: ChoiceItem, index: number): string => {\n return `modal-select-item-${index + 1}`;\n};\n\nconst createRenderItem = (value: ChoiceValue, testID: String, onChange: OnChangeFunction) => ({\n item,\n index\n}: {\n item: ChoiceItem;\n index: number;\n}) => {\n // eslint-disable-next-line unicorn/consistent-function-scoping\n const handleChange = (_value: ChoiceValue | void) => () => onChange(_value);\n\n return (\n <ModalSelectItem\n onPress={handleChange(item.text)}\n isSelected={value === item.text}\n testID={`${testID}-item-${index + 1}`}\n >\n {item.text}\n </ModalSelectItem>\n );\n};\n\nconst createSeparator = (styleSheet: StyleSheetType) => () => {\n return <View style={styleSheet?.separator} />;\n};\n\nconst ModalSelect = (props: Props) => {\n const templateContext = useTemplateContext();\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const {theme} = templateContext;\n const {value, values, onChange, onClose, testID = 'modal-select'} = props;\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n const renderItem = useMemo(() => createRenderItem(value, testID, onChange), [\n value,\n testID,\n onChange\n ]);\n const renderSeparator = useMemo(() => createSeparator(styleSheet), [styleSheet]);\n\n if (!styleSheet) {\n return null;\n }\n\n return (\n <Modal onClose={onClose} contentStyle={styleSheet?.content} testID={testID}>\n <FlatList\n data={values}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n showsVerticalScrollIndicator={false}\n ItemSeparatorComponent={renderSeparator}\n style={styleSheet?.list}\n testID={`${testID}-items`}\n />\n </Modal>\n );\n};\n\nexport default ModalSelect;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import Text from '../../../atom/text/index.native';
|
|
4
|
+
import Touchable from '../../touchable/index.native';
|
|
5
|
+
import { useTemplateContext } from '../../../template/app-review/template-context';
|
|
6
|
+
|
|
7
|
+
const createStyleSheet = (brandTheme, theme) => StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: theme.colors.white,
|
|
10
|
+
padding: theme.spacing.small
|
|
11
|
+
},
|
|
12
|
+
text: {
|
|
13
|
+
fontWeight: theme.fontWeight.bold,
|
|
14
|
+
color: theme.colors.black
|
|
15
|
+
},
|
|
16
|
+
selectedTextStyle: {
|
|
17
|
+
color: brandTheme?.colors.primary
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const ModalSelectItem = props => {
|
|
22
|
+
const templateContext = useTemplateContext();
|
|
23
|
+
const [styleSheet, setStylesheet] = useState(null);
|
|
24
|
+
const {
|
|
25
|
+
brandTheme,
|
|
26
|
+
theme
|
|
27
|
+
} = templateContext;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const _stylesheet = createStyleSheet(brandTheme, theme);
|
|
30
|
+
|
|
31
|
+
setStylesheet(_stylesheet);
|
|
32
|
+
}, [theme, brandTheme]);
|
|
33
|
+
|
|
34
|
+
if (!styleSheet) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
children,
|
|
40
|
+
onPress,
|
|
41
|
+
isSelected,
|
|
42
|
+
testID
|
|
43
|
+
} = props;
|
|
44
|
+
return /*#__PURE__*/React.createElement(Touchable, {
|
|
45
|
+
onPress: onPress,
|
|
46
|
+
style: styleSheet.container,
|
|
47
|
+
testID: testID
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
49
|
+
style: [styleSheet.text, isSelected && styleSheet.selectedTextStyle]
|
|
50
|
+
}, children));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default ModalSelectItem;
|
|
54
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hoc/modal/select-item/index.native.tsx"],"names":["React","useState","useEffect","StyleSheet","Text","Touchable","useTemplateContext","createStyleSheet","brandTheme","theme","create","container","backgroundColor","colors","white","padding","spacing","small","text","fontWeight","bold","color","black","selectedTextStyle","primary","ModalSelectItem","props","templateContext","styleSheet","setStylesheet","_stylesheet","children","onPress","isSelected","testID"],"mappings":"AAAA,OAAOA,KAAP,IAAeC,QAAf,EAAyBC,SAAzB,QAAyC,OAAzC;AACA,SAAQC,UAAR,QAAoC,cAApC;AAGA,OAAOC,IAAP,MAAiB,iCAAjB;AACA,OAAOC,SAAP,MAAsB,8BAAtB;AACA,SAAQC,kBAAR,QAAiC,+CAAjC;;AAwBA,MAAMC,gBAAgB,GAAG,CAACC,UAAD,EAAkBC,KAAlB,KACvBN,UAAU,CAACO,MAAX,CAAkB;AAChBC,EAAAA,SAAS,EAAE;AACTC,IAAAA,eAAe,EAAEH,KAAK,CAACI,MAAN,CAAaC,KADrB;AAETC,IAAAA,OAAO,EAAEN,KAAK,CAACO,OAAN,CAAcC;AAFd,GADK;AAKhBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,UAAU,EAAEV,KAAK,CAACU,UAAN,CAAiBC,IADzB;AAEJC,IAAAA,KAAK,EAAEZ,KAAK,CAACI,MAAN,CAAaS;AAFhB,GALU;AAShBC,EAAAA,iBAAiB,EAAE;AACjBF,IAAAA,KAAK,EAAEb,UAAU,EAAEK,MAAZ,CAAmBW;AADT;AATH,CAAlB,CADF;;AAeA,MAAMC,eAAe,GAAIC,KAAD,IAAkB;AACxC,QAAMC,eAAe,GAAGrB,kBAAkB,EAA1C;AACA,QAAM,CAACsB,UAAD,EAAaC,aAAb,IAA8B5B,QAAQ,CAAwB,IAAxB,CAA5C;AACA,QAAM;AAACO,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAAsBkB,eAA5B;AAEAzB,EAAAA,SAAS,CAAC,MAAM;AACd,UAAM4B,WAAW,GAAGvB,gBAAgB,CAACC,UAAD,EAAaC,KAAb,CAApC;;AACAoB,IAAAA,aAAa,CAACC,WAAD,CAAb;AACD,GAHQ,EAGN,CAACrB,KAAD,EAAQD,UAAR,CAHM,CAAT;;AAKA,MAAI,CAACoB,UAAL,EAAiB;AACf,WAAO,IAAP;AACD;;AAED,QAAM;AAACG,IAAAA,QAAD;AAAWC,IAAAA,OAAX;AAAoBC,IAAAA,UAApB;AAAgCC,IAAAA;AAAhC,MAA0CR,KAAhD;AAEA,sBACE,oBAAC,SAAD;AAAW,IAAA,OAAO,EAAEM,OAApB;AAA6B,IAAA,KAAK,EAAEJ,UAAU,CAACjB,SAA/C;AAA0D,IAAA,MAAM,EAAEuB;AAAlE,kBACE,oBAAC,IAAD;AAAM,IAAA,KAAK,EAAE,CAACN,UAAU,CAACV,IAAZ,EAAkBe,UAAU,IAAIL,UAAU,CAACL,iBAA3C;AAAb,KAA6EQ,QAA7E,CADF,CADF;AAKD,CArBD;;AAuBA,eAAeN,eAAf","sourcesContent":["import React, {useState, useEffect} from 'react';\nimport {StyleSheet, TextStyle} from 'react-native';\nimport type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';\n\nimport Text from '../../../atom/text/index.native';\nimport Touchable from '../../touchable/index.native';\nimport {useTemplateContext} from '../../../template/app-review/template-context';\nimport {Theme} from '../../../variables/theme.native';\n\nexport type Props = {\n isSelected?: boolean;\n children: string;\n onPress?: (event: PressEvent) => any;\n testID?: string;\n};\n\ntype StyleSheetType = {\n container: {\n backgroundColor: string;\n padding: number;\n };\n text: {\n fontWeight: TextStyle;\n color: string;\n };\n selectedTextStyle: {\n color: string;\n };\n};\n\nconst createStyleSheet = (brandTheme: any, theme: Theme) =>\n StyleSheet.create({\n container: {\n backgroundColor: theme.colors.white,\n padding: theme.spacing.small\n },\n text: {\n fontWeight: theme.fontWeight.bold,\n color: theme.colors.black\n },\n selectedTextStyle: {\n color: brandTheme?.colors.primary\n }\n });\n\nconst ModalSelectItem = (props: Props) => {\n const templateContext = useTemplateContext();\n const [styleSheet, setStylesheet] = useState<StyleSheetType | null>(null);\n const {brandTheme, theme} = templateContext;\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(brandTheme, theme);\n setStylesheet(_stylesheet);\n }, [theme, brandTheme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {children, onPress, isSelected, testID} = props;\n\n return (\n <Touchable onPress={onPress} style={styleSheet.container} testID={testID}>\n <Text style={[styleSheet.text, isSelected && styleSheet.selectedTextStyle]}>{children}</Text>\n </Touchable>\n );\n};\n\nexport default ModalSelectItem;\n"],"file":"index.native.js"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import { TouchableOpacity, TouchableHighlight } from 'react-native';
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { useTemplateContext } from '../../template/app-review/template-context';
|
|
6
|
+
import { ANALYTICS_EVENT_TYPE } from '../../variables/analytics';
|
|
7
|
+
const hitSlop = {
|
|
8
|
+
left: 12,
|
|
9
|
+
right: 12,
|
|
10
|
+
bottom: 12,
|
|
11
|
+
top: 12
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const logEvent = (eventName, analyticsID, analytics, analyticsParams) => {
|
|
15
|
+
analytics && analytics.logEvent(eventName, _extends(_extends({}, analyticsParams || {}), {}, {
|
|
16
|
+
id: analyticsID
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const Touchable = props => {
|
|
21
|
+
const templateContext = useTemplateContext();
|
|
22
|
+
const {
|
|
23
|
+
theme,
|
|
24
|
+
vibration,
|
|
25
|
+
analytics
|
|
26
|
+
} = templateContext;
|
|
27
|
+
const {
|
|
28
|
+
analyticsID,
|
|
29
|
+
analyticsParams,
|
|
30
|
+
onPress,
|
|
31
|
+
onLongPress,
|
|
32
|
+
isWithoutFeedback,
|
|
33
|
+
isHighlight,
|
|
34
|
+
activeOpacity,
|
|
35
|
+
disabled
|
|
36
|
+
} = props;
|
|
37
|
+
const handlePress = useMemo(() => event => {
|
|
38
|
+
if (!onPress) return;
|
|
39
|
+
vibration?.vibrate();
|
|
40
|
+
analytics && logEvent(ANALYTICS_EVENT_TYPE.PRESS, analyticsID, analytics, analyticsParams);
|
|
41
|
+
onPress(event);
|
|
42
|
+
}, [analytics, analyticsID, analyticsParams, onPress, vibration]);
|
|
43
|
+
const handleLongPress = useMemo(() => event => {
|
|
44
|
+
if (!onLongPress) return;
|
|
45
|
+
vibration?.vibrate();
|
|
46
|
+
analytics && logEvent(ANALYTICS_EVENT_TYPE.LONG_PRESS, analyticsID, analytics, analyticsParams);
|
|
47
|
+
onLongPress(event);
|
|
48
|
+
}, [analytics, analyticsID, analyticsParams, onLongPress, vibration]);
|
|
49
|
+
|
|
50
|
+
if (isHighlight) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(TouchableHighlight, _extends({}, props, {
|
|
52
|
+
hitSlop: hitSlop,
|
|
53
|
+
underlayColor: theme.colors.gray.light,
|
|
54
|
+
onPress: handlePress,
|
|
55
|
+
onLongPress: handleLongPress,
|
|
56
|
+
activeOpacity: activeOpacity || (disabled ? 1 : 0.85)
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return /*#__PURE__*/React.createElement(TouchableOpacity, _extends({}, props, {
|
|
61
|
+
hitSlop: hitSlop,
|
|
62
|
+
onPress: handlePress,
|
|
63
|
+
onLongPress: handleLongPress,
|
|
64
|
+
activeOpacity: isWithoutFeedback && 1 || activeOpacity || (disabled ? 1 : 0.2)
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default Touchable;
|
|
69
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/hoc/touchable/index.native.tsx"],"names":["TouchableOpacity","TouchableHighlight","React","useMemo","useTemplateContext","ANALYTICS_EVENT_TYPE","hitSlop","left","right","bottom","top","logEvent","eventName","analyticsID","analytics","analyticsParams","id","Touchable","props","templateContext","theme","vibration","onPress","onLongPress","isWithoutFeedback","isHighlight","activeOpacity","disabled","handlePress","event","vibrate","PRESS","handleLongPress","LONG_PRESS","colors","gray","light"],"mappings":";;AAAA,SAAQA,gBAAR,EAA0BC,kBAA1B,QAA8D,cAA9D;AAQA,OAAOC,KAAP,IAAeC,OAAf,QAA6B,OAA7B;AACA,SAAQC,kBAAR,QAAiC,4CAAjC;AACA,SAAQC,oBAAR,QAAoE,2BAApE;AAGA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAE,EADQ;AAEdC,EAAAA,KAAK,EAAE,EAFO;AAGdC,EAAAA,MAAM,EAAE,EAHM;AAIdC,EAAAA,GAAG,EAAE;AAJS,CAAhB;;AAmCA,MAAMC,QAAQ,GAAG,CACfC,SADe,EAEfC,WAFe,EAGfC,SAHe,EAIfC,eAJe,KAKZ;AACHD,EAAAA,SAAS,IACPA,SAAS,CAACH,QAAV,CAAmBC,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WAAJ,EAAiB;AACf,wBACE,oBAAC,kBAAD,eACMP,KADN;AAEE,MAAA,OAAO,EAAEZ,OAFX;AAGE,MAAA,aAAa,EAAEc,KAAK,CAACc,MAAN,CAAaC,IAAb,CAAkBC,KAHnC;AAIE,MAAA,OAAO,EAAER,WAJX;AAKE,MAAA,WAAW,EAAEI,eALf;AAME,MAAA,aAAa,EAAEN,aAAa,KAAKC,QAAQ,GAAG,CAAH,GAAO,IAApB;AAN9B,OADF;AAUD;;AAED,sBACE,oBAAC,gBAAD,eACMT,KADN;AAEE,IAAA,OAAO,EAAEZ,OAFX;AAGE,IAAA,OAAO,EAAEsB,WAHX;AAIE,IAAA,WAAW,EAAEI,eAJf;AAKE,IAAA,aAAa,EAAGR,iBAAiB,IAAI,CAAtB,IAA4BE,aAA5B,KAA8CC,QAAQ,GAAG,CAAH,GAAO,GAA7D;AALjB,KADF;AASD,CA/DD;;AAiEA,eAAeV,SAAf","sourcesContent":["import {TouchableOpacity, TouchableHighlight, ViewStyle} from 'react-native';\nimport type {\n BlurEvent,\n LayoutEvent,\n FocusEvent,\n PressEvent\n} from 'react-native/Libraries/Types/CoreEventTypes';\n\nimport React, {useMemo} from 'react';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport {ANALYTICS_EVENT_TYPE, Analytics, AnalyticsEventParams} from '../../variables/analytics';\nimport {Vibration} from '../../variables/vibration';\n\nconst hitSlop = {\n left: 12,\n right: 12,\n bottom: 12,\n top: 12\n};\n\nexport type Props = {\n accessible?: boolean;\n children?: React.ReactNode;\n delayLongPress?: number;\n delayPressIn?: number;\n delayPressOut?: number;\n disabled?: boolean;\n focusable?: boolean;\n onBlur?: (event: BlurEvent) => any;\n onFocus?: (event: FocusEvent) => any;\n onLayout?: (event: LayoutEvent) => any;\n onLongPress?: (event: PressEvent) => any;\n onPress?: (event: PressEvent) => any;\n onPressIn?: (event: PressEvent) => any;\n onPressOut?: (event: PressEvent) => any;\n testID?: string;\n isHighlight?: boolean;\n isWithoutFeedback?: boolean;\n // for TouchableOpacity\n activeOpacity?: number;\n style?: ViewStyle;\n // Analytics\n analytics?: Analytics;\n analyticsID?: string;\n analyticsParams?: AnalyticsEventParams;\n vibration?: Vibration;\n};\n\nconst logEvent = (\n eventName: string,\n analyticsID: String,\n analytics: Analytics,\n analyticsParams: AnalyticsEventParams | undefined\n) => {\n analytics &&\n analytics.logEvent(eventName, {\n ...(analyticsParams || {}),\n id: analyticsID\n });\n};\n\nconst Touchable = (props: Props) => {\n const templateContext = useTemplateContext();\n\n const {theme, vibration, analytics} = templateContext;\n\n const {\n analyticsID,\n analyticsParams,\n onPress,\n onLongPress,\n isWithoutFeedback,\n isHighlight,\n activeOpacity,\n disabled\n } = props;\n\n const handlePress = useMemo(\n () => (event: PressEvent) => {\n if (!onPress) return;\n\n vibration?.vibrate();\n\n analytics && logEvent(ANALYTICS_EVENT_TYPE.PRESS, analyticsID, analytics, analyticsParams);\n onPress(event);\n },\n [analytics, analyticsID, analyticsParams, onPress, vibration]\n );\n\n const handleLongPress = useMemo(\n () => (event: PressEvent) => {\n if (!onLongPress) return;\n\n vibration?.vibrate();\n\n analytics &&\n logEvent(ANALYTICS_EVENT_TYPE.LONG_PRESS, analyticsID, analytics, analyticsParams);\n onLongPress(event);\n },\n [analytics, analyticsID, analyticsParams, onLongPress, vibration]\n );\n\n if (isHighlight) {\n return (\n <TouchableHighlight\n {...props}\n hitSlop={hitSlop}\n underlayColor={theme.colors.gray.light}\n onPress={handlePress}\n onLongPress={handleLongPress}\n activeOpacity={activeOpacity || (disabled ? 1 : 0.85)}\n />\n );\n }\n\n return (\n <TouchableOpacity\n {...props}\n hitSlop={hitSlop}\n onPress={handlePress}\n onLongPress={handleLongPress}\n activeOpacity={(isWithoutFeedback && 1) || activeOpacity || (disabled ? 1 : 0.2)}\n />\n );\n};\n\nexport default Touchable;\n"],"file":"index.native.js"}
|
package/es/index.js
CHANGED
|
@@ -3,5 +3,6 @@ import PopinEnd from './template/app-player/popin-end';
|
|
|
3
3
|
import PopinCorrection from './template/app-player/popin-correction';
|
|
4
4
|
import Player from './template/app-player/player';
|
|
5
5
|
import Loading from './template/app-player/loading';
|
|
6
|
-
|
|
6
|
+
import PopinNoAccess from './template/app-player/popin-no-access';
|
|
7
|
+
export { Provider, PopinEnd, PopinCorrection, Loading, Player, PopinNoAccess };
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["Provider","PopinEnd","PopinCorrection","Player","Loading"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,iCAArB;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,MAAP,MAAmB,8BAAnB;AACA,OAAOC,OAAP,MAAoB,+BAApB;AAEA,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["Provider","PopinEnd","PopinCorrection","Player","Loading","PopinNoAccess"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,iBAArB;AACA,OAAOC,QAAP,MAAqB,iCAArB;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,MAAP,MAAmB,8BAAnB;AACA,OAAOC,OAAP,MAAoB,+BAApB;AACA,OAAOC,aAAP,MAA0B,uCAA1B;AAEA,SAAQL,QAAR,EAAkBC,QAAlB,EAA4BC,eAA5B,EAA6CE,OAA7C,EAAsDD,MAAtD,EAA8DE,aAA9D","sourcesContent":["import Provider from './atom/provider';\nimport PopinEnd from './template/app-player/popin-end';\nimport PopinCorrection from './template/app-player/popin-correction';\nimport Player from './template/app-player/player';\nimport Loading from './template/app-player/loading';\nimport PopinNoAccess from './template/app-player/popin-no-access';\n\nexport {Provider, PopinEnd, PopinCorrection, Loading, Player, PopinNoAccess};\n"],"file":"index.js"}
|
|
@@ -13,15 +13,23 @@ const CMPopin = props => {
|
|
|
13
13
|
secondButton,
|
|
14
14
|
onClose,
|
|
15
15
|
header,
|
|
16
|
-
icon
|
|
16
|
+
icon,
|
|
17
|
+
backgroundImageUrl,
|
|
18
|
+
descriptionText
|
|
17
19
|
} = props;
|
|
18
20
|
const logo = {
|
|
19
21
|
AlertDiamond,
|
|
20
22
|
WindowUpload
|
|
21
23
|
};
|
|
22
24
|
const LogoComponent = logo[icon];
|
|
25
|
+
const backgroundImageStyle = backgroundImageUrl ? {
|
|
26
|
+
backgroundImage: `url(${backgroundImageUrl})`,
|
|
27
|
+
backgroundSize: 'cover'
|
|
28
|
+
} : null;
|
|
23
29
|
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
-
className: style.background
|
|
30
|
+
className: style.background,
|
|
31
|
+
style: backgroundImageStyle,
|
|
32
|
+
"data-name": 'cm-popin-container'
|
|
25
33
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
34
|
className: style.popin
|
|
27
35
|
}, /*#__PURE__*/React.createElement("header", {
|
|
@@ -36,16 +44,24 @@ const CMPopin = props => {
|
|
|
36
44
|
size: "small",
|
|
37
45
|
icon: "close"
|
|
38
46
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
className: style.titleContainer
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
49
|
className: style.contentSection
|
|
40
50
|
}, LogoComponent ? /*#__PURE__*/React.createElement(LogoComponent, {
|
|
41
51
|
className: style.icon
|
|
42
52
|
}) : null, content ? /*#__PURE__*/React.createElement("p", {
|
|
43
53
|
className: mode === 'alert' ? style.content : style.message,
|
|
44
|
-
"data-name":
|
|
54
|
+
"data-name": 'cm-popin-content' // eslint-disable-next-line react/no-danger
|
|
45
55
|
,
|
|
46
56
|
dangerouslySetInnerHTML: {
|
|
47
57
|
__html: content
|
|
48
58
|
}
|
|
59
|
+
}) : null), descriptionText ? /*#__PURE__*/React.createElement("p", {
|
|
60
|
+
className: style.descriptionText // eslint-disable-next-line react/no-danger
|
|
61
|
+
,
|
|
62
|
+
dangerouslySetInnerHTML: {
|
|
63
|
+
__html: descriptionText
|
|
64
|
+
}
|
|
49
65
|
}) : null), /*#__PURE__*/React.createElement("div", {
|
|
50
66
|
className: style.buttonContainer
|
|
51
67
|
}, firstButton ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -53,16 +69,16 @@ const CMPopin = props => {
|
|
|
53
69
|
}, /*#__PURE__*/React.createElement(Cta, {
|
|
54
70
|
label: firstButton.label,
|
|
55
71
|
onClick: firstButton.handleOnclick,
|
|
56
|
-
"data-name":
|
|
72
|
+
"data-name": 'cm-popin-cta',
|
|
57
73
|
"aria-label": firstButton['aria-label'],
|
|
58
74
|
type: firstButton.type
|
|
59
75
|
})) : null, secondButton ? /*#__PURE__*/React.createElement("div", {
|
|
60
|
-
className: style.button
|
|
76
|
+
className: secondButton.largeButton ? style.largeButton : style.button
|
|
61
77
|
}, /*#__PURE__*/React.createElement(Cta, {
|
|
62
78
|
label: secondButton.label,
|
|
63
79
|
onClick: secondButton.handleOnclick,
|
|
64
80
|
"data-name": `cm-popin-cta-${secondButton.type}`,
|
|
65
|
-
"aria-label":
|
|
81
|
+
"aria-label": secondButton['aria-label'],
|
|
66
82
|
type: secondButton.type
|
|
67
83
|
})) : null)));
|
|
68
84
|
};
|
|
@@ -81,10 +97,13 @@ CMPopin.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
81
97
|
label: PropTypes.string,
|
|
82
98
|
handleOnclick: PropTypes.func,
|
|
83
99
|
type: PropTypes.oneOf(['dangerous', 'primary']),
|
|
84
|
-
'aria-label': PropTypes.string
|
|
100
|
+
'aria-label': PropTypes.string,
|
|
101
|
+
largeButton: PropTypes.boolean
|
|
85
102
|
}),
|
|
86
103
|
onClose: PropTypes.func,
|
|
87
|
-
icon: PropTypes.string
|
|
104
|
+
icon: PropTypes.string,
|
|
105
|
+
backgroundImageUrl: PropTypes.string,
|
|
106
|
+
descriptionText: PropTypes.string
|
|
88
107
|
} : {};
|
|
89
108
|
export default CMPopin;
|
|
90
109
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/molecule/cm-popin/index.js"],"names":["React","PropTypes","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","Cta","ButtonLinkIconOnly","style","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","logo","LogoComponent","background","popin","popinHeader","headerBackground","contentSection","message","__html","buttonContainer","button","label","handleOnclick","type","propTypes","string","oneOf","shape","func"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,QAGO,0BAHP;AAIA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AAEA,MAAMC,OAAO,GAAGC,KAAK,IAAI;AACvB,QAAM;
|
|
1
|
+
{"version":3,"sources":["../../../src/molecule/cm-popin/index.js"],"names":["React","PropTypes","NovaSolidInterfaceFeedbackInterfaceAlertDiamond","AlertDiamond","NovaSolidApplicationsWindowUpload3","WindowUpload","Cta","ButtonLinkIconOnly","style","CMPopin","props","content","mode","firstButton","secondButton","onClose","header","icon","backgroundImageUrl","descriptionText","logo","LogoComponent","backgroundImageStyle","backgroundImage","backgroundSize","background","popin","popinHeader","headerBackground","titleContainer","contentSection","message","__html","buttonContainer","button","label","handleOnclick","type","largeButton","propTypes","string","oneOf","shape","func","boolean"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SACEC,+CAA+C,IAAIC,YADrD,EAEEC,kCAAkC,IAAIC,YAFxC,QAGO,0BAHP;AAIA,OAAOC,GAAP,MAAgB,wBAAhB;AACA,OAAOC,kBAAP,MAA+B,kCAA/B;AACA,OAAOC,KAAP,MAAkB,aAAlB;;AA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AAoB;AAClB5B,EAAAA,OAAO,EAAEV,SAAS,CAACuC,MADD;AAElB5B,EAAAA,IAAI,EAAEX,SAAS,CAACwC,KAAV,CAAgB,CAAC,OAAD,EAAU,aAAV,CAAhB,CAFY;AAGlBzB,EAAAA,MAAM,EAAEf,SAAS,CAACuC,MAHA;AAIlB3B,EAAAA,WAAW,EAAEZ,SAAS,CAACyC,KAAV,CAAgB;AAC3BP,IAAAA,KAAK,EAAElC,SAAS,CAACuC,MADU;AAE3BJ,IAAAA,aAAa,EAAEnC,SAAS,CAAC0C,IAFE;AAG3B,kBAAc1C,SAAS,CAACuC,MAHG;AAI3BH,IAAAA,IAAI,EAAEpC,SAAS,CAACuC;AAJW,GAAhB,CAJK;AAUlB1B,EAAAA,YAAY,EAAEb,SAAS,CAACyC,KAAV,CAAgB;AAC5BP,IAAAA,KAAK,EAAElC,SAAS,CAACuC,MADW;AAE5BJ,IAAAA,aAAa,EAAEnC,SAAS,CAAC0C,IAFG;AAG5BN,IAAAA,IAAI,EAAEpC,SAAS,CAACwC,KAAV,CAAgB,CAAC,WAAD,EAAc,SAAd,CAAhB,CAHsB;AAI5B,kBAAcxC,SAAS,CAACuC,MAJI;AAK5BF,IAAAA,WAAW,EAAErC,SAAS,CAAC2C;AALK,GAAhB,CAVI;AAiBlB7B,EAAAA,OAAO,EAAEd,SAAS,CAAC0C,IAjBD;AAkBlB1B,EAAAA,IAAI,EAAEhB,SAAS,CAACuC,MAlBE;AAmBlBtB,EAAAA,kBAAkB,EAAEjB,SAAS,CAACuC,MAnBZ;AAoBlBrB,EAAAA,eAAe,EAAElB,SAAS,CAACuC;AApBT,CAApB;AAuBA,eAAe/B,OAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {\n NovaSolidInterfaceFeedbackInterfaceAlertDiamond as AlertDiamond,\n NovaSolidApplicationsWindowUpload3 as WindowUpload\n} from '@coorpacademy/nova-icons';\nimport Cta from '../../atom/button-link';\nimport ButtonLinkIconOnly from '../../atom/button-link-icon-only';\nimport style from './style.css';\n\nconst CMPopin = props => {\n const {\n content,\n mode = 'alert',\n firstButton,\n secondButton,\n onClose,\n header,\n icon,\n backgroundImageUrl,\n descriptionText\n } = props;\n\n const logo = {\n AlertDiamond,\n WindowUpload\n };\n const LogoComponent = logo[icon];\n\n const backgroundImageStyle = backgroundImageUrl\n ? {\n backgroundImage: `url(${backgroundImageUrl})`,\n backgroundSize: 'cover'\n }\n : null;\n\n return (\n <div className={style.background} style={backgroundImageStyle} data-name={'cm-popin-container'}>\n <div className={style.popin}>\n <header className={style.popinHeader}>\n {header ? <img className={style.headerBackground} src={header} /> : null}\n {onClose ? (\n <ButtonLinkIconOnly\n onClick={onClose}\n data-name={'close-icon'}\n aria-label={'close-icon'}\n size=\"small\"\n icon=\"close\"\n />\n ) : null}\n </header>\n <div className={style.titleContainer}>\n <div className={style.contentSection}>\n {LogoComponent ? <LogoComponent className={style.icon} /> : null}\n {content ? (\n <p\n className={mode === 'alert' ? style.content : style.message}\n data-name={'cm-popin-content'}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: content}}\n />\n ) : null}\n </div>\n {descriptionText ? (\n <p\n className={style.descriptionText}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{__html: descriptionText}}\n />\n ) : null}\n </div>\n <div className={style.buttonContainer}>\n {firstButton ? (\n <div className={style.button}>\n <Cta\n label={firstButton.label}\n onClick={firstButton.handleOnclick}\n data-name={'cm-popin-cta'}\n aria-label={firstButton['aria-label']}\n type={firstButton.type}\n />\n </div>\n ) : null}\n {secondButton ? (\n <div className={secondButton.largeButton ? style.largeButton : style.button}>\n <Cta\n label={secondButton.label}\n onClick={secondButton.handleOnclick}\n data-name={`cm-popin-cta-${secondButton.type}`}\n aria-label={secondButton['aria-label']}\n type={secondButton.type}\n />\n </div>\n ) : null}\n </div>\n </div>\n </div>\n );\n};\n\nCMPopin.propTypes = {\n content: PropTypes.string,\n mode: PropTypes.oneOf(['alert', 'information']),\n header: PropTypes.string,\n firstButton: PropTypes.shape({\n label: PropTypes.string,\n handleOnclick: PropTypes.func,\n 'aria-label': PropTypes.string,\n type: PropTypes.string\n }),\n secondButton: PropTypes.shape({\n label: PropTypes.string,\n handleOnclick: PropTypes.func,\n type: PropTypes.oneOf(['dangerous', 'primary']),\n 'aria-label': PropTypes.string,\n largeButton: PropTypes.boolean\n }),\n onClose: PropTypes.func,\n icon: PropTypes.string,\n backgroundImageUrl: PropTypes.string,\n descriptionText: PropTypes.string\n};\n\nexport default CMPopin;\n"],"file":"index.js"}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
@value cm_grey_100 from colors;
|
|
15
15
|
@value cm_grey_200 from colors;
|
|
16
16
|
@value cm_blue_600 from colors;
|
|
17
|
+
@value cm_grey_500 from colors;
|
|
17
18
|
|
|
18
19
|
.background {
|
|
19
20
|
top: 0px;
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
overflow: hidden;
|
|
29
30
|
display: flex;
|
|
30
31
|
position:fixed;
|
|
32
|
+
z-index: 3;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
.headerBackground {
|
|
@@ -37,7 +39,6 @@
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
.popin {
|
|
40
|
-
position: absolute;
|
|
41
42
|
overflow: auto;
|
|
42
43
|
width: 500px;
|
|
43
44
|
height: 414px;
|
|
@@ -112,6 +113,11 @@
|
|
|
112
113
|
padding: 8px;
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
.largeButton {
|
|
117
|
+
width: 338px;
|
|
118
|
+
padding: 8px;
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
.icon {
|
|
116
122
|
width: 60px;
|
|
117
123
|
height: 60px;
|
|
@@ -126,4 +132,21 @@
|
|
|
126
132
|
|
|
127
133
|
.popinHeader button {
|
|
128
134
|
position: absolute;
|
|
135
|
+
}
|
|
136
|
+
.descriptionText {
|
|
137
|
+
text-align: center;
|
|
138
|
+
font-family: Gilroy;
|
|
139
|
+
font-weight: 500;
|
|
140
|
+
font-size: 16px;
|
|
141
|
+
line-height: 22px;
|
|
142
|
+
color: cm_grey_500;
|
|
143
|
+
font-style: normal;
|
|
144
|
+
white-space: pre-line;
|
|
145
|
+
margin-top: 0px;
|
|
146
|
+
}
|
|
147
|
+
.titleContainer {
|
|
148
|
+
align-items: center;
|
|
149
|
+
display: flex;
|
|
150
|
+
flex-direction: column;
|
|
151
|
+
width: 100%;
|
|
129
152
|
}
|
|
@@ -2,8 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import BattleRequest from '../../battle-request';
|
|
4
4
|
import style from './style.css';
|
|
5
|
-
|
|
6
|
-
const BattleRequestList = (props, context) => {
|
|
5
|
+
const BattleRequestList = React.memo(function BattleRequestList(props) {
|
|
7
6
|
const {
|
|
8
7
|
requests
|
|
9
8
|
} = props;
|
|
@@ -17,10 +16,9 @@ const BattleRequestList = (props, context) => {
|
|
|
17
16
|
className: style.list,
|
|
18
17
|
"data-name": "battle-request-list"
|
|
19
18
|
}, cards);
|
|
20
|
-
};
|
|
21
|
-
|
|
19
|
+
});
|
|
22
20
|
BattleRequestList.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
23
21
|
requests: PropTypes.arrayOf(PropTypes.shape(BattleRequest.propTypes))
|
|
24
22
|
} : {};
|
|
25
|
-
export default
|
|
23
|
+
export default BattleRequestList;
|
|
26
24
|
//# sourceMappingURL=index.js.map
|