@dcl/react-ecs 7.1.2 → 7.1.3-4448471926.commit-264de76
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.
|
@@ -3,19 +3,17 @@ import { getFont, getTextAlign } from '../Label/utils';
|
|
|
3
3
|
import { parseUiBackground } from '../uiBackground';
|
|
4
4
|
import { parseUiTransform } from '../uiTransform';
|
|
5
5
|
function getButtonProps(props) {
|
|
6
|
-
if (props.variant === 'primary') {
|
|
7
|
-
return {
|
|
8
|
-
uiBackground: { color: { r: 0.98, g: 0.17, b: 0.33, a: 1 } },
|
|
9
|
-
uiText: { color: { r: 1, g: 1, b: 1, a: 1 } }
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
6
|
if (props.variant === 'secondary') {
|
|
13
7
|
return {
|
|
14
8
|
uiBackground: { color: { r: 1, g: 1, b: 1, a: 1 } },
|
|
15
9
|
uiText: { color: { r: 0.98, g: 0.17, b: 0.33, a: 1 } }
|
|
16
10
|
};
|
|
17
11
|
}
|
|
18
|
-
|
|
12
|
+
// 'primary' variant by default
|
|
13
|
+
return {
|
|
14
|
+
uiBackground: { color: { r: 0.98, g: 0.17, b: 0.33, a: 1 } },
|
|
15
|
+
uiText: { color: { r: 1, g: 1, b: 1, a: 1 } }
|
|
16
|
+
};
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
*
|
|
@@ -48,5 +46,11 @@ export function Button(props) {
|
|
|
48
46
|
height: 36,
|
|
49
47
|
...uiTransform
|
|
50
48
|
});
|
|
51
|
-
|
|
49
|
+
if (!!props.disabled) {
|
|
50
|
+
if (textProps.color)
|
|
51
|
+
textProps.color.a /= 2;
|
|
52
|
+
if (uiBackgroundProps && uiBackgroundProps.color)
|
|
53
|
+
uiBackgroundProps.color.a /= 2;
|
|
54
|
+
}
|
|
55
|
+
return (ReactEcs.createElement("entity", { onMouseDown: !!props.disabled ? undefined : onMouseDown, onMouseUp: !!props.disabled ? undefined : onMouseUp, uiTransform: uiTransformProps, uiText: textProps, uiBackground: uiBackgroundProps }));
|
|
52
56
|
}
|
|
@@ -9,4 +9,8 @@ export interface UiButtonProps extends UiLabelProps, EntityPropTypes {
|
|
|
9
9
|
* Use any of the available button style types to create a styled button.
|
|
10
10
|
*/
|
|
11
11
|
variant?: 'primary' | 'secondary';
|
|
12
|
+
/**
|
|
13
|
+
* Enable or disable the pointer events on the button
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
12
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/react-ecs",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.3-4448471926.commit-264de76",
|
|
4
4
|
"description": "Decentraland ECS",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/react-reconciler": "^0.28.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dcl/ecs": "7.1.
|
|
31
|
+
"@dcl/ecs": "7.1.3-4448471926.commit-264de76",
|
|
32
32
|
"react": "^18.2.0",
|
|
33
33
|
"react-reconciler": "^0.29.0"
|
|
34
34
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"displayName": "React ECS",
|
|
43
43
|
"tsconfig": "./tsconfig.json"
|
|
44
44
|
},
|
|
45
|
-
"commit": "
|
|
45
|
+
"commit": "264de7682c191f5abc8dbe754ea1b7e5fac96c4c"
|
|
46
46
|
}
|