@bigbinary/neetoui-rn 0.0.16 → 0.0.20
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/lib/components/Button.js +53 -9
- package/lib/theme/index.js +19 -8
- package/package.json +1 -1
package/lib/components/Button.js
CHANGED
|
@@ -1,30 +1,74 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
flexbox,
|
|
4
|
+
space,
|
|
5
|
+
border,
|
|
6
|
+
buttonStyle,
|
|
7
|
+
color,
|
|
8
|
+
layout,
|
|
9
|
+
} from "styled-system";
|
|
3
10
|
import styled from "styled-components/native";
|
|
4
11
|
import propTypes from "@styled-system/prop-types";
|
|
5
|
-
import
|
|
12
|
+
import { Typography } from "@components";
|
|
6
13
|
|
|
7
14
|
export const TouchableOpacity = styled.TouchableOpacity`
|
|
15
|
+
${buttonStyle}
|
|
8
16
|
${flexbox}
|
|
9
17
|
${space}
|
|
10
18
|
${border}
|
|
11
|
-
${
|
|
19
|
+
${layout}
|
|
20
|
+
${color}
|
|
12
21
|
`;
|
|
13
22
|
|
|
14
|
-
export const Button = ({
|
|
15
|
-
|
|
23
|
+
export const Button = ({
|
|
24
|
+
RightIcon,
|
|
25
|
+
LeftIcon,
|
|
26
|
+
fontFamily,
|
|
27
|
+
color,
|
|
28
|
+
fontSize,
|
|
29
|
+
...rest
|
|
30
|
+
}) => {
|
|
31
|
+
const { disabled } = rest;
|
|
32
|
+
let style = rest.style || {};
|
|
33
|
+
if (disabled) {
|
|
34
|
+
style = { ...style, opacity: 0.5 };
|
|
35
|
+
}
|
|
36
|
+
return (
|
|
37
|
+
<TouchableOpacity
|
|
38
|
+
flexDirection="row"
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
{...rest}
|
|
41
|
+
style={style}
|
|
42
|
+
>
|
|
43
|
+
{RightIcon && <RightIcon />}
|
|
44
|
+
<Typography
|
|
45
|
+
textAlign="center"
|
|
46
|
+
mx={1}
|
|
47
|
+
color={color}
|
|
48
|
+
fontFamily={fontFamily || "inter700"}
|
|
49
|
+
fontSize={fontSize || "s"}
|
|
50
|
+
textStyle={rest.variant}
|
|
51
|
+
>
|
|
52
|
+
{rest.label}
|
|
53
|
+
</Typography>
|
|
54
|
+
{LeftIcon && <LeftIcon />}
|
|
55
|
+
</TouchableOpacity>
|
|
56
|
+
);
|
|
16
57
|
};
|
|
17
58
|
|
|
18
59
|
Button.defaultProps = {
|
|
19
|
-
variant: "
|
|
20
|
-
p:
|
|
60
|
+
variant: "solid",
|
|
61
|
+
p: 12,
|
|
21
62
|
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
borderRadius: 2,
|
|
22
65
|
};
|
|
23
66
|
|
|
24
67
|
Button.propTypes = {
|
|
68
|
+
...propTypes.buttonStyle,
|
|
25
69
|
...propTypes.flexbox,
|
|
26
70
|
...propTypes.space,
|
|
27
71
|
...propTypes.border,
|
|
28
|
-
...propTypes.
|
|
29
|
-
|
|
72
|
+
...propTypes.layout,
|
|
73
|
+
...propTypes.color,
|
|
30
74
|
};
|
package/lib/theme/index.js
CHANGED
|
@@ -86,19 +86,30 @@ export const theme = {
|
|
|
86
86
|
color: baseTheme.colors.font.primary,
|
|
87
87
|
fontSize: baseTheme.fontSizes.s,
|
|
88
88
|
},
|
|
89
|
+
|
|
90
|
+
// buttonTextStyles
|
|
91
|
+
solid: {
|
|
92
|
+
color: baseTheme.colors.font.white,
|
|
93
|
+
},
|
|
94
|
+
inverse: {
|
|
95
|
+
color: baseTheme.colors.font.base,
|
|
96
|
+
},
|
|
97
|
+
text: {
|
|
98
|
+
color: baseTheme.colors.font.base,
|
|
99
|
+
},
|
|
89
100
|
},
|
|
90
101
|
buttons: {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
backgroundColor: baseTheme.colors.grey800,
|
|
102
|
+
solid: {
|
|
103
|
+
backgroundColor: baseTheme.colors.background.base,
|
|
94
104
|
},
|
|
95
|
-
|
|
96
|
-
|
|
105
|
+
inverse: {
|
|
106
|
+
border: 2,
|
|
107
|
+
borderColor: baseTheme.colors.white,
|
|
97
108
|
backgroundColor: baseTheme.colors.white,
|
|
98
109
|
},
|
|
99
|
-
|
|
100
|
-
color:
|
|
101
|
-
backgroundColor: baseTheme.colors.
|
|
110
|
+
text: {
|
|
111
|
+
color: baseTheme.colors.grey800,
|
|
112
|
+
backgroundColor: baseTheme.colors.white,
|
|
102
113
|
},
|
|
103
114
|
},
|
|
104
115
|
};
|