@holper/react-native-holper-storybook 0.6.5 → 0.6.6
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import {TouchableOpacity, ViewPropTypes, ActivityIndicator} from 'react-native';
|
|
4
4
|
import withPreventDoubleClick from './../PreventDoubleClick';
|
|
5
|
-
import {
|
|
5
|
+
import {Colors} from '../../configs/constants';
|
|
6
6
|
import style from './style';
|
|
7
7
|
|
|
8
|
-
const Button = ({
|
|
8
|
+
const Button = ({onPress, disabled, isLoading, bordered, variant, size, noShadow, style: customStyle, children}) => {
|
|
9
9
|
const getSpinnerColor = () => {
|
|
10
|
-
switch(variant) {
|
|
10
|
+
switch (variant) {
|
|
11
11
|
case 'primary':
|
|
12
12
|
case 'inverted':
|
|
13
13
|
case 'error':
|
|
@@ -23,21 +23,21 @@ const Button = ({ onPress, disabled, isLoading, bordered, variant, size, noShado
|
|
|
23
23
|
style.button,
|
|
24
24
|
style[variant],
|
|
25
25
|
style[size],
|
|
26
|
-
bordered ? style.bordered: {},
|
|
27
|
-
disabled ? style.disabled: {},
|
|
28
|
-
noShadow ? style.noShadow: {},
|
|
26
|
+
bordered ? style.bordered : {},
|
|
27
|
+
disabled ? style.disabled : {},
|
|
28
|
+
noShadow ? style.noShadow : {},
|
|
29
29
|
customStyle
|
|
30
30
|
]}
|
|
31
31
|
disabled={isLoading || disabled}
|
|
32
32
|
onPress={onPress}
|
|
33
33
|
>
|
|
34
34
|
{isLoading ?
|
|
35
|
-
<ActivityIndicator color={getSpinnerColor()} size={28}
|
|
35
|
+
<ActivityIndicator color={getSpinnerColor()} size={28}/> :
|
|
36
36
|
children
|
|
37
37
|
}
|
|
38
38
|
</TouchableOpacity>
|
|
39
39
|
);
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
|
|
42
42
|
Button.defaultProps = {
|
|
43
43
|
children: null,
|
|
@@ -48,7 +48,8 @@ Button.defaultProps = {
|
|
|
48
48
|
variant: 'primary',
|
|
49
49
|
size: 'medium',
|
|
50
50
|
style: {},
|
|
51
|
-
onPress: () => {
|
|
51
|
+
onPress: () => {
|
|
52
|
+
},
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
Button.propTypes = {
|
|
@@ -57,7 +58,7 @@ Button.propTypes = {
|
|
|
57
58
|
isLoading: PropTypes.bool,
|
|
58
59
|
bordered: PropTypes.bool,
|
|
59
60
|
noShadow: PropTypes.bool,
|
|
60
|
-
variant: PropTypes.oneOf(['primary', 'secondary', 'dim', 'light', 'inverted', 'error']),
|
|
61
|
+
variant: PropTypes.oneOf(['primary', 'secondary', 'dim', 'light', 'inverted', 'error', 'highlight']),
|
|
61
62
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'fit', 'icon']),
|
|
62
63
|
style: ViewPropTypes.style,
|
|
63
64
|
onPress: PropTypes.func,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {Dimensions} from 'react-native';
|
|
2
|
+
import {Colors} from '../../configs/constants';
|
|
3
3
|
|
|
4
|
-
const {
|
|
4
|
+
const {width} = Dimensions.get('window');
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
// Default button shape
|
|
@@ -15,8 +15,8 @@ export default {
|
|
|
15
15
|
justifyContent: 'center',
|
|
16
16
|
alignItems: 'center',
|
|
17
17
|
borderWidth: 1,
|
|
18
|
-
shadowOffset: {
|
|
19
|
-
shadowOpacity:
|
|
18
|
+
shadowOffset: {width: 0, height: 4},
|
|
19
|
+
shadowOpacity: 0.4,
|
|
20
20
|
shadowRadius: 3,
|
|
21
21
|
elevation: 5,
|
|
22
22
|
},
|
|
@@ -51,6 +51,11 @@ export default {
|
|
|
51
51
|
backgroundColor: Colors.red,
|
|
52
52
|
shadowColor: Colors.red
|
|
53
53
|
},
|
|
54
|
+
highlight: {
|
|
55
|
+
borderColor: Colors.violet,
|
|
56
|
+
backgroundColor: Colors.violet,
|
|
57
|
+
shadowColor: Colors.violet
|
|
58
|
+
},
|
|
54
59
|
// Bordered
|
|
55
60
|
bordered: {
|
|
56
61
|
shadowColor: Colors.transparent,
|
|
@@ -82,4 +87,4 @@ export default {
|
|
|
82
87
|
shadowColor: Colors.transparent,
|
|
83
88
|
elevation: 0
|
|
84
89
|
}
|
|
85
|
-
}
|
|
90
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
3
|
+
import {Text as RNText} from 'react-native';
|
|
4
4
|
import style from './style';
|
|
5
5
|
|
|
6
|
-
const Text = ({
|
|
6
|
+
const Text = ({variant, size, color, weight, align, style: customStyle, children, ...props}) => (
|
|
7
7
|
<RNText
|
|
8
8
|
style={[
|
|
9
9
|
style[variant],
|
|
@@ -31,7 +31,7 @@ Text.defaultProps = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
Text.propTypes = {
|
|
34
|
-
color: PropTypes.oneOf(['dark', 'light', 'lighter', 'white', 'green', 'red', 'yellow']),
|
|
34
|
+
color: PropTypes.oneOf(['dark', 'light', 'lighter', 'white', 'green', 'red', 'yellow', 'violet']),
|
|
35
35
|
variant: PropTypes.oneOf(['default', 'lowercase', 'uppercase']),
|
|
36
36
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'extra-large']),
|
|
37
37
|
weight: PropTypes.oneOf(['regular', 'bold', 'semiBold']),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Colors} from '../../configs/constants';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
// colors
|
|
@@ -23,6 +23,9 @@ export default {
|
|
|
23
23
|
yellow: {
|
|
24
24
|
color: Colors.yellow
|
|
25
25
|
},
|
|
26
|
+
violet: {
|
|
27
|
+
color: Colors.violet
|
|
28
|
+
},
|
|
26
29
|
// variants
|
|
27
30
|
lowercase: {
|
|
28
31
|
textTransform: 'lowercase'
|
|
@@ -69,4 +72,4 @@ export default {
|
|
|
69
72
|
justify: {
|
|
70
73
|
textAlign: 'justify'
|
|
71
74
|
}
|
|
72
|
-
}
|
|
75
|
+
};
|