@@ -8,19 +8,19 @@ class Base extends React.Component {
88 getStyles ( ) {
99 let styles = { } ;
1010 if ( this . props . italic ) {
11- styles = assign ( styles , { fontStyle : 'italic' } ) ;
11+ styles . fontStyle = 'italic' ;
1212 }
1313 if ( this . props . bold ) {
14- styles = assign ( styles , { fontWeight : 'bold' } ) ;
14+ styles . fontWeight = 'bold' ;
1515 }
1616 if ( this . props . caps ) {
17- styles = assign ( styles , { textTransform : 'uppercase' } ) ;
17+ styles . textTransform = 'uppercase' ;
1818 }
1919 if ( this . props . margin ) {
20- styles = assign ( styles , { margin : this . props . margin } ) ;
20+ styles . margin = this . props . margin ;
2121 }
2222 if ( this . props . padding ) {
23- styles = assign ( styles , { margin : this . props . padding } ) ;
23+ styles . padding = this . props . padding ;
2424 }
2525 if ( this . props . textColor ) {
2626 let color = "" ;
@@ -29,16 +29,22 @@ class Base extends React.Component {
2929 } else {
3030 color = this . context . styles . colors [ this . props . textColor ]
3131 }
32- styles = assign ( styles , { color : color } ) ;
32+ styles . color = color ;
3333 }
3434 if ( this . props . textFont ) {
35- styles = assign ( styles , { fontFamily : this . context . styles . fonts [ this . props . textFont ] } ) ;
35+ let font = "" ;
36+ if ( ! this . context . styles . fonts . hasOwnProperty ( this . props . textFont ) ) {
37+ font = this . props . textFont
38+ } else {
39+ font = this . context . styles . fonts [ this . props . textFont ]
40+ }
41+ styles . fontFamily = font ;
3642 }
3743 if ( this . props . textSize ) {
38- styles = assign ( styles , { fontSize : this . props . textSize } ) ;
44+ styles . fontSize = this . props . textSize ;
3945 }
4046 if ( this . props . textAlign ) {
41- styles = assign ( styles , { textAlign : this . props . textAlign } ) ;
47+ styles . textAlign = this . props . textAlign ;
4248 }
4349 if ( this . props . bgColor ) {
4450 let color = "" ;
@@ -47,14 +53,14 @@ class Base extends React.Component {
4753 } else {
4854 color = this . context . styles . colors [ this . props . bgColor ]
4955 }
50- styles = assign ( styles , { backgroundColor : color } ) ;
56+ styles . backgroundColor = color ;
5157 }
5258 if ( this . props . bgImage ) {
53- styles = assign ( styles , { backgroundImage :
59+ styles . backgroundImage =
5460 'linear-gradient( rgba(0, 0, 0, ' + this . props . bgDarken +
5561 '), rgba(0, 0, 0, ' + this . props . bgDarken +
56- ') ), url(' + this . props . bgImage + ')' } ) ;
57- styles = assign ( styles , { backgroundSize : 'cover' } ) ;
62+ ') ), url(' + this . props . bgImage + ')' ;
63+ styles . backgroundSize = 'cover' ;
5864 }
5965 return styles ;
6066 }
@@ -79,19 +85,19 @@ Base.Mixin = {
7985 getStyles ( ) {
8086 let styles = { } ;
8187 if ( this . props . italic ) {
82- styles = assign ( styles , { fontStyle : 'italic' } ) ;
88+ styles . fontStyle = 'italic' ;
8389 }
8490 if ( this . props . bold ) {
85- styles = assign ( styles , { fontWeight : 'bold' } ) ;
91+ styles . fontWeight = 'bold' ;
8692 }
8793 if ( this . props . caps ) {
88- styles = assign ( styles , { textTransform : 'uppercase' } ) ;
94+ styles . textTransform = 'uppercase' ;
8995 }
9096 if ( this . props . margin ) {
91- styles = assign ( styles , { margin : this . props . margin } ) ;
97+ styles . margin = this . props . margin ;
9298 }
9399 if ( this . props . padding ) {
94- styles = assign ( styles , { margin : this . props . padding } ) ;
100+ styles . padding = this . props . padding ;
95101 }
96102 if ( this . props . textColor ) {
97103 let color = "" ;
@@ -100,16 +106,22 @@ Base.Mixin = {
100106 } else {
101107 color = this . context . styles . colors [ this . props . textColor ]
102108 }
103- styles = assign ( styles , { color : color } ) ;
109+ styles . color = color ;
104110 }
105111 if ( this . props . textFont ) {
106- styles = assign ( styles , { fontFamily : this . context . styles . fonts [ this . props . textFont ] } ) ;
112+ let font = "" ;
113+ if ( ! this . context . styles . fonts . hasOwnProperty ( this . props . textFont ) ) {
114+ font = this . props . textFont
115+ } else {
116+ font = this . context . styles . colors [ this . props . textFont ]
117+ }
118+ styles . fontFamily = font ;
107119 }
108120 if ( this . props . textSize ) {
109- styles = assign ( styles , { fontSize : this . props . textSize } ) ;
121+ styles . fontSize = this . props . textSize ;
110122 }
111123 if ( this . props . textAlign ) {
112- styles = assign ( styles , { textAlign : this . props . textAlign } ) ;
124+ styles . textAlign = this . props . textAlign ;
113125 }
114126 if ( this . props . bgColor ) {
115127 let color = "" ;
@@ -118,14 +130,14 @@ Base.Mixin = {
118130 } else {
119131 color = this . context . styles . colors [ this . props . bgColor ]
120132 }
121- styles = assign ( styles , { backgroundColor : color } ) ;
133+ styles . backgroundColor = color ;
122134 }
123135 if ( this . props . bgImage ) {
124- styles = assign ( styles , { backgroundImage :
136+ styles . backgroundImage =
125137 'linear-gradient( rgba(0, 0, 0, ' + this . props . bgDarken +
126138 '), rgba(0, 0, 0, ' + this . props . bgDarken +
127- ') ), url(' + this . props . bgImage + ')' } ) ;
128- styles = assign ( styles , { backgroundSize : 'cover' } ) ;
139+ ') ), url(' + this . props . bgImage + ')' ;
140+ styles . backgroundSize = 'cover' ;
129141 }
130142 return styles ;
131143 }
0 commit comments