From 6b203ed6e6ac1af3e5f5a7d3752b55e1618f9cf7 Mon Sep 17 00:00:00 2001 From: Sean Future Date: Wed, 17 Aug 2016 15:53:39 -0400 Subject: [PATCH] Support for child controls --- MessageBar.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/MessageBar.js b/MessageBar.js index dbe985e..8589437 100644 --- a/MessageBar.js +++ b/MessageBar.js @@ -59,6 +59,7 @@ class MessageBar extends Component { /* Cusomisation of the alert: Title, Message, Icon URL, Alert alertType (error, success, warning, info), Duration for Alert keep shown */ title: props.title, message: props.message, + children: props.children, avatar: props.avatar, alertType: props.alertType || 'info', duration: props.duration || 3000, @@ -116,7 +117,7 @@ class MessageBar extends Component { */ showMessageBarAlert() { // If an alert is already shonw or doesn't have a title or a message, do nothing - if (this.alertShown || (this.state.title == null && this.state.message == null)) { + if (this.alertShown || (this.state.title == null && this.state.message == null && this.state.children == null)) { return; } @@ -404,13 +405,20 @@ class MessageBar extends Component { } renderMessage() { + var controls = []; if (this.state.message != null) { - return ( - + controls.push( + { this.state.message } ); } + if (this.state.children != null) { + controls.push( + this.state.children + ); + } + return controls; } }