@proximus/lavender-patch-native 0.1.0-alpha.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.md +25 -0
- package/dist/PxPatch.d.ts +17 -0
- package/dist/PxPatch.d.ts.map +1 -0
- package/dist/PxPatchAdvantages.d.ts +13 -0
- package/dist/PxPatchAdvantages.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/styles.d.ts +60 -0
- package/dist/styles.d.ts.map +1 -0
- package/package.json +41 -0
- package/src/PxPatch.tsx +174 -0
- package/src/PxPatchAdvantages.tsx +99 -0
- package/src/assets/belfius-epic.png +0 -0
- package/src/assets/belfius-epic@2x.png +0 -0
- package/src/assets/belfius-epic@3x.png +0 -0
- package/src/assets/belfius.png +0 -0
- package/src/assets/belfius@2x.png +0 -0
- package/src/assets/belfius@3x.png +0 -0
- package/src/assets/mobile-advantages.png +0 -0
- package/src/assets/mobile-advantages@2x.png +0 -0
- package/src/assets/mobile-advantages@3x.png +0 -0
- package/src/index.ts +2 -0
- package/src/styles.ts +61 -0
- package/tsconfig.json +8 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 0.1.0-alpha.0 (2025-08-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
11
|
+
- **BCRI-3651742:** patch module ([46bf85e](https://github.com/Pxs-Corporate/react-native-lavender/commit/46bf85e225088cd3d90ed84a7e54c070a421805e))
|
|
12
|
+
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
13
|
+
- **BCRI-4002610:** update package versions and add new dependencies for styling and icon handling ([bd36e12](https://github.com/Pxs-Corporate/react-native-lavender/commit/bd36e120c36fd33602f441ceed5f41f15f81f0ea))
|
|
14
|
+
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
15
|
+
- **BCRI-4210372:** fix bad version numbers ([bc6a8ba](https://github.com/Pxs-Corporate/react-native-lavender/commit/bc6a8ba48c15347442f2ac38dacae7ffba3d95eb))
|
|
16
|
+
|
|
17
|
+
# (2025-08-13)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- **BCRI-000000:** remove default E2E on DEV env build for all components ([a5d27bf](https://github.com/Pxs-Corporate/react-native-lavender/commit/a5d27bfaaebf5b75f3160f31c64b590b7bd00b93))
|
|
22
|
+
- **BCRI-3651742:** patch module ([46bf85e](https://github.com/Pxs-Corporate/react-native-lavender/commit/46bf85e225088cd3d90ed84a7e54c070a421805e))
|
|
23
|
+
- **BCRI-4002610:** update icon handling and remove deprecated font references ([4399fe4](https://github.com/Pxs-Corporate/react-native-lavender/commit/4399fe4bff06aa70f5c29705fcc89d5243b0e3e7))
|
|
24
|
+
- **BCRI-4002610:** update package versions and add new dependencies for styling and icon handling ([bd36e12](https://github.com/Pxs-Corporate/react-native-lavender/commit/bd36e120c36fd33602f441ceed5f41f15f81f0ea))
|
|
25
|
+
- **BCRI-4210372:** automatic versionning ([9c1f0a0](https://github.com/Pxs-Corporate/react-native-lavender/commit/9c1f0a00e19a9d1a277044ea627632032a674102))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { IconName } from '@proximus/lavender-icon/dist/iconNames.js';
|
|
4
|
+
export interface IPxPatchProps {
|
|
5
|
+
title: string;
|
|
6
|
+
testID?: string;
|
|
7
|
+
iconName?: IconName;
|
|
8
|
+
type: 'promo' | 'info' | 'blackfriday' | 'eco' | 'belfius' | 'mobile';
|
|
9
|
+
borderType?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
10
|
+
clickable?: boolean;
|
|
11
|
+
isFocused?: boolean;
|
|
12
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
onPress?: () => void;
|
|
14
|
+
lightContent?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function PxPatch({ title, testID, type, iconName, borderType, clickable, isFocused, wrapperStyle, onPress, lightContent, ...accessibilityProps }: IPxPatchProps & AccessibilityProps): React.JSX.Element;
|
|
17
|
+
//# sourceMappingURL=PxPatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxPatch.d.ts","sourceRoot":"","sources":["../src/PxPatch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAElB,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAQtB,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,aAAa,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtE,UAAU,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,CAAC;IACnE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAiB,EACjB,SAAiB,EACjB,YAAY,EACZ,OAAO,EACP,YAAoB,EACpB,GAAG,kBAAkB,EACtB,EAAE,aAAa,GAAG,kBAAkB,qBAmIpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AccessibilityProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface IPxBubbleAdvantagesProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
testID?: string;
|
|
6
|
+
type: 'mobile' | 'belfius';
|
|
7
|
+
iconName?: string;
|
|
8
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
lightContent?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function PxPatchAdvantages({ title, testID, type, wrapperStyle, onPress, lightContent, ...accessibilityProps }: IPxBubbleAdvantagesProps & AccessibilityProps): React.JSX.Element;
|
|
13
|
+
//# sourceMappingURL=PxPatchAdvantages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PxPatchAdvantages.d.ts","sourceRoot":"","sources":["../src/PxPatchAdvantages.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,kBAAkB,EAElB,SAAS,EAGT,SAAS,EACV,MAAM,cAAc,CAAC;AAQtB,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,GAAG,kBAAkB,EACtB,EAAE,wBAAwB,GAAG,kBAAkB,qBAwD/C"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
bubbleLeft: {
|
|
3
|
+
borderTopLeftRadius: number;
|
|
4
|
+
borderTopRightRadius: number;
|
|
5
|
+
borderBottomRightRadius: number;
|
|
6
|
+
};
|
|
7
|
+
bubbleRight: {
|
|
8
|
+
borderTopLeftRadius: number;
|
|
9
|
+
borderTopRightRadius: number;
|
|
10
|
+
borderBottomLeftRadius: number;
|
|
11
|
+
};
|
|
12
|
+
bubble: {
|
|
13
|
+
height: number;
|
|
14
|
+
alignItems: "center";
|
|
15
|
+
flexDirection: "row";
|
|
16
|
+
paddingLeft: number;
|
|
17
|
+
paddingRight: number;
|
|
18
|
+
};
|
|
19
|
+
bubbleText: {
|
|
20
|
+
fontSize: number;
|
|
21
|
+
};
|
|
22
|
+
bubbleV7: {
|
|
23
|
+
alignItems: "center";
|
|
24
|
+
flexDirection: "row";
|
|
25
|
+
paddingHorizontal: number;
|
|
26
|
+
paddingVertical: number;
|
|
27
|
+
borderRadius: number;
|
|
28
|
+
};
|
|
29
|
+
bubbleAdvantages: {
|
|
30
|
+
alignItems: "center";
|
|
31
|
+
flexDirection: "row";
|
|
32
|
+
paddingHorizontal: number;
|
|
33
|
+
paddingVertical: number;
|
|
34
|
+
borderRadius: number;
|
|
35
|
+
};
|
|
36
|
+
bubbleTextV7: {
|
|
37
|
+
fontFamily: string;
|
|
38
|
+
fontWeight: "700";
|
|
39
|
+
fontSize: number;
|
|
40
|
+
textAlignVertical: "center";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export declare const colors: {
|
|
44
|
+
promo: string;
|
|
45
|
+
info: string;
|
|
46
|
+
blackfriday: string;
|
|
47
|
+
blackfridayEpic: string;
|
|
48
|
+
eco: string;
|
|
49
|
+
ecoEpic: string;
|
|
50
|
+
belfius: string;
|
|
51
|
+
mobile: string;
|
|
52
|
+
black: string;
|
|
53
|
+
white: string;
|
|
54
|
+
style1Gradient: string[];
|
|
55
|
+
style2Gradient: string[];
|
|
56
|
+
style3Gradient: string[];
|
|
57
|
+
shadowColor1: string;
|
|
58
|
+
shadowColor3: string;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCjB,CAAC;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAgBlB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-patch-native",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Lavender patch component",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"prepublish": "yarn clean && yarn build",
|
|
12
|
+
"build": "npx tsc -p tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
"peerDependencies": {
|
|
15
|
+
"@proximus/lavender-common-native": "workspace:*",
|
|
16
|
+
"@proximus/lavender-icon-native": "workspace:*",
|
|
17
|
+
"@proximus/lavender-styling-native": "workspace:*",
|
|
18
|
+
"@proximus/lavender-texts-native": "workspace:*"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@proximus/lavender-common-native": "0.1.0-alpha.0",
|
|
22
|
+
"@proximus/lavender-icon-native": "0.1.0-alpha.0",
|
|
23
|
+
"@proximus/lavender-styling-native": "0.1.0-alpha.0",
|
|
24
|
+
"@proximus/lavender-texts-native": "0.1.0-alpha.0"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"lerna": {
|
|
30
|
+
"command": {
|
|
31
|
+
"publish": {
|
|
32
|
+
"assets": [
|
|
33
|
+
"dist",
|
|
34
|
+
"src",
|
|
35
|
+
"package.json"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"gitHead": "27525289a448a6e4f3c2d36a88b9dc54d0f15fbf"
|
|
41
|
+
}
|
package/src/PxPatch.tsx
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityProps,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
StyleProp,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
|
|
10
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
11
|
+
|
|
12
|
+
import { colors, styles } from './styles';
|
|
13
|
+
import { PxPatchAdvantages } from './PxPatchAdvantages';
|
|
14
|
+
import { Header } from '@proximus/lavender-texts-native';
|
|
15
|
+
import { PxIcon } from '@proximus/lavender-icon-native';
|
|
16
|
+
import { IconName } from '@proximus/lavender-icon/dist/iconNames.js';
|
|
17
|
+
|
|
18
|
+
export interface IPxPatchProps {
|
|
19
|
+
title: string;
|
|
20
|
+
testID?: string;
|
|
21
|
+
iconName?: IconName;
|
|
22
|
+
type: 'promo' | 'info' | 'blackfriday' | 'eco' | 'belfius' | 'mobile';
|
|
23
|
+
borderType?: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight';
|
|
24
|
+
clickable?: boolean;
|
|
25
|
+
isFocused?: boolean;
|
|
26
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
27
|
+
onPress?: () => void;
|
|
28
|
+
lightContent?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function PxPatch({
|
|
32
|
+
title,
|
|
33
|
+
testID,
|
|
34
|
+
type,
|
|
35
|
+
iconName,
|
|
36
|
+
borderType,
|
|
37
|
+
clickable = false,
|
|
38
|
+
isFocused = false,
|
|
39
|
+
wrapperStyle,
|
|
40
|
+
onPress,
|
|
41
|
+
lightContent = false,
|
|
42
|
+
...accessibilityProps
|
|
43
|
+
}: IPxPatchProps & AccessibilityProps) {
|
|
44
|
+
const backgroundColor = () => {
|
|
45
|
+
if (type === 'promo') {
|
|
46
|
+
if (isFocused) {
|
|
47
|
+
return {
|
|
48
|
+
backgroundColor: colors.white,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
backgroundColor: colors.promo,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (type === 'info') {
|
|
56
|
+
return {
|
|
57
|
+
backgroundColor: colors.info,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (type === 'blackfriday') {
|
|
61
|
+
if (lightContent) {
|
|
62
|
+
return {
|
|
63
|
+
backgroundColor: colors.blackfridayEpic,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
backgroundColor: colors.blackfriday,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (type === 'eco') {
|
|
71
|
+
return {
|
|
72
|
+
backgroundColor: colors.eco,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
const borderStyle = () => {
|
|
78
|
+
if (borderType === 'topLeft') {
|
|
79
|
+
return {
|
|
80
|
+
borderTopLeftRadius: 0,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (borderType === 'topRight') {
|
|
84
|
+
return {
|
|
85
|
+
borderTopRightRadius: 0,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (borderType === 'bottomLeft') {
|
|
89
|
+
return {
|
|
90
|
+
borderBottomLeftRadius: 0,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (borderType === 'bottomRight') {
|
|
94
|
+
return {
|
|
95
|
+
borderBottomRightRadius: 0,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const fontColor = () => {
|
|
102
|
+
if (type === 'blackfriday' && lightContent) {
|
|
103
|
+
return colors.black;
|
|
104
|
+
}
|
|
105
|
+
if (type === 'info') {
|
|
106
|
+
return colors.black;
|
|
107
|
+
}
|
|
108
|
+
if (type === 'promo' && isFocused) {
|
|
109
|
+
return colors.promo;
|
|
110
|
+
}
|
|
111
|
+
return colors.white;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const focusedBorderStyle = () => {
|
|
115
|
+
if (isFocused && type === 'promo') {
|
|
116
|
+
return {
|
|
117
|
+
borderWidth: 3,
|
|
118
|
+
backgroundColor: colors.white,
|
|
119
|
+
borderColor: colors.promo,
|
|
120
|
+
paddingVertical: 0,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
if (type === 'belfius' || type === 'mobile') {
|
|
127
|
+
return (
|
|
128
|
+
<PxPatchAdvantages
|
|
129
|
+
type={type}
|
|
130
|
+
title={title}
|
|
131
|
+
lightContent={lightContent}
|
|
132
|
+
/>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const Wrapper = (clickable ? TouchableOpacity : View) as React.ElementType;
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<Wrapper
|
|
140
|
+
style={[
|
|
141
|
+
styles.bubbleV7,
|
|
142
|
+
borderStyle(),
|
|
143
|
+
backgroundColor(),
|
|
144
|
+
focusedBorderStyle(),
|
|
145
|
+
wrapperStyle,
|
|
146
|
+
]}
|
|
147
|
+
accessible={false}
|
|
148
|
+
disabled={!clickable}
|
|
149
|
+
onPress={clickable ? onPress : undefined}
|
|
150
|
+
{...(clickable
|
|
151
|
+
? a11y({
|
|
152
|
+
accessibilityRole: 'button',
|
|
153
|
+
accessible: true,
|
|
154
|
+
...accessibilityProps,
|
|
155
|
+
})
|
|
156
|
+
: {})}
|
|
157
|
+
{...e2eID(testID + '-PxPatch')}
|
|
158
|
+
>
|
|
159
|
+
<Header style={[{ color: fontColor() }, styles.bubbleTextV7]}>
|
|
160
|
+
{title}
|
|
161
|
+
</Header>
|
|
162
|
+
{iconName && clickable && type === 'promo' && (
|
|
163
|
+
<PxIcon
|
|
164
|
+
name={iconName}
|
|
165
|
+
size={16}
|
|
166
|
+
style={{
|
|
167
|
+
marginLeft: 5,
|
|
168
|
+
color: fontColor(),
|
|
169
|
+
}}
|
|
170
|
+
/>
|
|
171
|
+
)}
|
|
172
|
+
</Wrapper>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AccessibilityProps,
|
|
4
|
+
Image,
|
|
5
|
+
StyleProp,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
import { a11y, e2eID } from '@proximus/lavender-common-native';
|
|
12
|
+
import { ThemeName, useTheme } from '@proximus/lavender-styling-native';
|
|
13
|
+
import { Header } from '@proximus/lavender-texts-native';
|
|
14
|
+
|
|
15
|
+
import { colors, styles } from './styles';
|
|
16
|
+
|
|
17
|
+
export interface IPxBubbleAdvantagesProps {
|
|
18
|
+
title?: string;
|
|
19
|
+
testID?: string;
|
|
20
|
+
type: 'mobile' | 'belfius';
|
|
21
|
+
iconName?: string;
|
|
22
|
+
wrapperStyle?: StyleProp<ViewStyle>;
|
|
23
|
+
onPress?: () => void;
|
|
24
|
+
lightContent?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function PxPatchAdvantages({
|
|
28
|
+
title,
|
|
29
|
+
testID,
|
|
30
|
+
type,
|
|
31
|
+
wrapperStyle,
|
|
32
|
+
onPress,
|
|
33
|
+
lightContent,
|
|
34
|
+
...accessibilityProps
|
|
35
|
+
}: IPxBubbleAdvantagesProps & AccessibilityProps) {
|
|
36
|
+
const { theme } = useTheme();
|
|
37
|
+
const isScarlet = theme.name === ThemeName.SCARLET;
|
|
38
|
+
|
|
39
|
+
const fontColor = () => {
|
|
40
|
+
if (type === 'belfius') {
|
|
41
|
+
if (isScarlet || lightContent) {
|
|
42
|
+
return { color: colors.belfius };
|
|
43
|
+
}
|
|
44
|
+
return { color: colors.white };
|
|
45
|
+
}
|
|
46
|
+
return { color: colors.black };
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const backgroundColor = () => {
|
|
50
|
+
if (type === 'mobile') {
|
|
51
|
+
return { backgroundColor: colors.mobile };
|
|
52
|
+
}
|
|
53
|
+
if (type === 'belfius') {
|
|
54
|
+
if (isScarlet || lightContent) {
|
|
55
|
+
return { backgroundColor: colors.white };
|
|
56
|
+
}
|
|
57
|
+
return { backgroundColor: colors.belfius };
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
};
|
|
61
|
+
const renderIcon = () => {
|
|
62
|
+
if (type === 'belfius') {
|
|
63
|
+
if (isScarlet || lightContent) {
|
|
64
|
+
return require('./assets/belfius-epic.png');
|
|
65
|
+
}
|
|
66
|
+
return require('./assets/belfius.png');
|
|
67
|
+
}
|
|
68
|
+
return require('./assets/mobile-advantages.png');
|
|
69
|
+
};
|
|
70
|
+
return (
|
|
71
|
+
<TouchableOpacity
|
|
72
|
+
style={[styles.bubbleAdvantages, backgroundColor(), wrapperStyle]}
|
|
73
|
+
accessible={false}
|
|
74
|
+
onPress={onPress}
|
|
75
|
+
{...a11y({
|
|
76
|
+
accessibilityRole: 'button',
|
|
77
|
+
accessible: true,
|
|
78
|
+
accessibilityIgnoresInvertColors: true,
|
|
79
|
+
...accessibilityProps,
|
|
80
|
+
})}
|
|
81
|
+
{...e2eID(testID + '-PxPatchAdvantages')}
|
|
82
|
+
>
|
|
83
|
+
<Image
|
|
84
|
+
style={CompStyles.imageIcon}
|
|
85
|
+
source={renderIcon()}
|
|
86
|
+
accessibilityIgnoresInvertColors
|
|
87
|
+
/>
|
|
88
|
+
<Header style={[fontColor(), styles.bubbleText]}>{title}</Header>
|
|
89
|
+
</TouchableOpacity>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const CompStyles = StyleSheet.create({
|
|
94
|
+
imageIcon: {
|
|
95
|
+
width: 24,
|
|
96
|
+
height: 24,
|
|
97
|
+
marginEnd: 8,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/index.ts
ADDED
package/src/styles.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
bubbleLeft: {
|
|
5
|
+
borderTopLeftRadius: 17,
|
|
6
|
+
borderTopRightRadius: 17,
|
|
7
|
+
borderBottomRightRadius: 17,
|
|
8
|
+
},
|
|
9
|
+
bubbleRight: {
|
|
10
|
+
borderTopLeftRadius: 17,
|
|
11
|
+
borderTopRightRadius: 17,
|
|
12
|
+
borderBottomLeftRadius: 17,
|
|
13
|
+
},
|
|
14
|
+
bubble: {
|
|
15
|
+
height: 30,
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
flexDirection: 'row',
|
|
18
|
+
paddingLeft: 10,
|
|
19
|
+
paddingRight: 10,
|
|
20
|
+
},
|
|
21
|
+
bubbleText: {
|
|
22
|
+
fontSize: 20,
|
|
23
|
+
},
|
|
24
|
+
bubbleV7: {
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
flexDirection: 'row',
|
|
27
|
+
paddingHorizontal: 12,
|
|
28
|
+
paddingVertical: 4,
|
|
29
|
+
borderRadius: 17,
|
|
30
|
+
},
|
|
31
|
+
bubbleAdvantages: {
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
paddingHorizontal: 12,
|
|
35
|
+
paddingVertical: 4,
|
|
36
|
+
borderRadius: 17,
|
|
37
|
+
},
|
|
38
|
+
bubbleTextV7: {
|
|
39
|
+
fontFamily: 'ProximusRegular',
|
|
40
|
+
fontWeight: '700',
|
|
41
|
+
fontSize: 14,
|
|
42
|
+
textAlignVertical: 'center',
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export const colors = {
|
|
46
|
+
promo: '#DE2A56',
|
|
47
|
+
info: '#00BCEE',
|
|
48
|
+
blackfriday: '#000000',
|
|
49
|
+
blackfridayEpic: '#ffffff',
|
|
50
|
+
eco: '#008000',
|
|
51
|
+
ecoEpic: '#2AD12A',
|
|
52
|
+
belfius: '#C30045',
|
|
53
|
+
mobile: '#C2EDEB',
|
|
54
|
+
black: '#000',
|
|
55
|
+
white: '#fff',
|
|
56
|
+
style1Gradient: ['#5C2D91', '#DE2B57'],
|
|
57
|
+
style2Gradient: ['#5C2D91', '#6393B6'],
|
|
58
|
+
style3Gradient: ['#0073CF', '#0073CF'],
|
|
59
|
+
shadowColor1: '#3A2254',
|
|
60
|
+
shadowColor3: '#001E36',
|
|
61
|
+
};
|