@@ -14,19 +14,21 @@ define([
1414
1515 class Alert extends Component {
1616 renderIcon ( ) {
17- switch ( this . props . type ) {
18- case 'error' :
19- return 'fa-exclamation-triangle' ;
20- case 'warning' :
21- return 'fa-exclamation-triangle' ;
22- case 'info' :
23- return 'fa-info' ;
24- case 'success' :
25- return 'fa-check' ;
17+ if ( this . props . showIcon ) {
18+ switch ( this . props . variant ) {
19+ case 'error' :
20+ return 'fa-exclamation-triangle' ;
21+ case 'warning' :
22+ return 'fa-exclamation-triangle' ;
23+ case 'info' :
24+ return 'fa-info' ;
25+ case 'success' :
26+ return 'fa-check' ;
27+ }
2628 }
2729 }
2830 renderAlertTypeClass ( ) {
29- switch ( this . props . type ) {
31+ switch ( this . props . variant ) {
3032 case 'error' :
3133 return 'danger' ;
3234 case 'warning' :
@@ -37,8 +39,14 @@ define([
3739 return 'success' ;
3840 }
3941 }
40- defaultTitle ( ) {
42+ renderAlertCustomClass ( ) {
4143 switch ( this . props . type ) {
44+ case 'inline' :
45+ return 'Alert-inline' ;
46+ }
47+ }
48+ defaultTitle ( ) {
49+ switch ( this . props . variant ) {
4250 case 'error' :
4351 return 'Error!' ;
4452 case 'warning' :
@@ -50,13 +58,15 @@ define([
5058 }
5159 }
5260 renderTitle ( ) {
53- const title = this . props . title || this . defaultTitle ( ) ;
54- return html `
55- < div className ="Alert-title ">
56- < span className =${ `fa ${ this . renderIcon ( ) } ` } / >
57- ${ title }
58- </ div >
59- ` ;
61+ if ( this . props . showTitle ) {
62+ const title = this . props . title || this . defaultTitle ( ) ;
63+ return html `
64+ < div className ="Alert-title ">
65+ < span className =${ `fa ${ this . renderIcon ( ) } ` } / >
66+ ${ title }
67+ </ div >
68+ ` ;
69+ }
6070 }
6171 render ( ) {
6272 const content = ( ( ) => {
@@ -67,7 +77,7 @@ define([
6777 } ) ( ) ;
6878 return html `
6979 < div
70- className =${ `alert alert-${ this . renderAlertTypeClass ( ) } Alert` }
80+ className =${ `alert alert-${ this . renderAlertTypeClass ( ) } ${ this . renderAlertCustomClass ( ) } Alert` }
7181 style =${ this . props . style }
7282 >
7383 ${ this . renderTitle ( ) }
0 commit comments