@@ -5,80 +5,112 @@ import { themeColor } from './../utils/ThemeUtils';
55interface ButtonProps {
66 title : string ;
77 icon ?: any ;
8+ titleStyle ?: any ;
89 onPress ?: any ;
910 secondary ?: boolean ;
1011 tertiary ?: boolean ;
1112 quaternary ?: boolean ;
1213 iconOnly ?: boolean ;
1314 adaptiveWidth ?: boolean ;
1415 containerStyle ?: any ;
16+ buttonStyle ?: any ;
1517 noUppercase ?: boolean ;
1618}
1719
1820function Button ( props : ButtonProps ) {
1921 const {
2022 title,
2123 icon,
24+ titleStyle,
2225 onPress,
2326 secondary,
2427 tertiary,
2528 quaternary,
2629 iconOnly,
2730 adaptiveWidth,
2831 containerStyle,
32+ buttonStyle,
2933 noUppercase
3034 } = props ;
3135
3236 const newContainerStyle : any = adaptiveWidth
3337 ? {
3438 ...containerStyle ,
3539 borderWidth : secondary ? 2 : 0 ,
36- borderColor : themeColor ( 'highlight' ) ,
40+ borderColor :
41+ ( containerStyle && containerStyle . borderColor ) ||
42+ themeColor ( 'highlight' ) ,
3743 alignSelf : 'center' ,
3844 borderRadius : 30
3945 }
4046 : {
4147 ...containerStyle ,
4248 borderWidth : secondary ? 2 : 0 ,
43- borderColor : themeColor ( 'highlight' ) ,
49+ borderColor :
50+ ( containerStyle && containerStyle . borderColor ) ||
51+ themeColor ( 'highlight' ) ,
4452 alignSelf : 'center' ,
4553 borderRadius : 30 ,
4654 width : '90%'
4755 } ;
4856
4957 return (
5058 < ElementsButton
51- icon = { {
52- ...icon ,
53- color : iconOnly
54- ? themeColor ( 'text' )
55- : secondary
56- ? themeColor ( 'highlight' )
57- : themeColor ( 'background' )
58- } }
59+ icon = {
60+ icon
61+ ? {
62+ color : icon . color
63+ ? icon . color
64+ : iconOnly
65+ ? themeColor ( 'text' )
66+ : secondary
67+ ? themeColor ( 'highlight' )
68+ : themeColor ( 'background' ) ,
69+ ...icon
70+ }
71+ : {
72+ color : iconOnly
73+ ? themeColor ( 'text' )
74+ : secondary
75+ ? themeColor ( 'highlight' )
76+ : themeColor ( 'background' )
77+ }
78+ }
5979 title = { title }
60- buttonStyle = { {
61- backgroundColor : iconOnly
62- ? 'transparent'
63- : quaternary
64- ? themeColor ( 'background' )
65- : tertiary
66- ? themeColor ( 'highlight' )
67- : secondary
68- ? themeColor ( 'secondary' )
69- : themeColor ( 'text' )
70- } }
71- titleStyle = { {
72- color : iconOnly
73- ? themeColor ( 'text' )
74- : quaternary
75- ? themeColor ( 'text' )
76- : secondary
77- ? themeColor ( 'highlight' )
78- : themeColor ( 'background' ) ,
79- textTransform : noUppercase ? 'none' : 'uppercase' ,
80- fontFamily : 'Lato-Bold'
81- } }
80+ buttonStyle = {
81+ buttonStyle
82+ ? buttonStyle
83+ : {
84+ backgroundColor : iconOnly
85+ ? 'transparent'
86+ : quaternary
87+ ? themeColor ( 'background' )
88+ : tertiary
89+ ? themeColor ( 'highlight' )
90+ : secondary
91+ ? themeColor ( 'secondary' )
92+ : themeColor ( 'text' )
93+ }
94+ }
95+ titleStyle = {
96+ titleStyle
97+ ? {
98+ ...titleStyle ,
99+ textTransform : noUppercase ? 'none' : 'uppercase' ,
100+ fontFamily : 'Lato-Bold'
101+ }
102+ : {
103+ color : iconOnly
104+ ? themeColor ( 'text' )
105+ : quaternary
106+ ? themeColor ( 'text' )
107+ : secondary
108+ ? themeColor ( 'highlight' )
109+ : themeColor ( 'background' ) ,
110+ textTransform : noUppercase ? 'none' : 'uppercase' ,
111+ fontFamily : 'Lato-Bold'
112+ }
113+ }
82114 onPress = { onPress }
83115 containerStyle = { newContainerStyle }
84116 />
0 commit comments