From bc61eb90cd5f012ecb1a8e2332b0ea9387aece63 Mon Sep 17 00:00:00 2001 From: geison20 Date: Thu, 6 Sep 2018 16:37:40 -0300 Subject: [PATCH 1/2] react-chat-widget: add base index --- dev/App.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/App.js b/dev/App.js index 8a10d049c..76e034441 100644 --- a/dev/App.js +++ b/dev/App.js @@ -10,6 +10,11 @@ export default class App extends Component { addResponseMessage(newMessage); } + handleOnChangeMessage = (event) => { + event.preventDefault(); + console.log(event.target.value); + } + render() { return ( Date: Thu, 6 Sep 2018 16:38:32 -0300 Subject: [PATCH 2/2] react-chat-widget: add prop handleOnChangeMessage --- dev/App.js | 1 + .../components/Conversation/components/Sender/index.js | 5 +++-- src/components/Widget/components/Conversation/index.js | 4 +++- src/components/Widget/index.js | 4 +++- src/components/Widget/layout.js | 4 +++- src/index.js | 4 +++- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/dev/App.js b/dev/App.js index 76e034441..d32befcfc 100644 --- a/dev/App.js +++ b/dev/App.js @@ -22,6 +22,7 @@ export default class App extends Component { subtitle="Asistente virtual" senderPlaceHolder="Escribe aquĆ­ ..." handleNewUserMessage={this.handleNewUserMessage} + handleOnChangeMessage={this.handleOnChangeMessage} badge={1} /> ); diff --git a/src/components/Widget/components/Conversation/components/Sender/index.js b/src/components/Widget/components/Conversation/components/Sender/index.js index 09367a749..892ae3de1 100644 --- a/src/components/Widget/components/Conversation/components/Sender/index.js +++ b/src/components/Widget/components/Conversation/components/Sender/index.js @@ -5,9 +5,9 @@ import send from '@assets/send_button.svg'; import './style.scss'; -const Sender = ({ sendMessage, placeholder, disabledInput, autofocus }) => +const Sender = ({ sendMessage, placeholder, disabledInput, autofocus, handleOnChangeMessage }) =>
- + @@ -15,6 +15,7 @@ const Sender = ({ sendMessage, placeholder, disabledInput, autofocus }) => Sender.propTypes = { sendMessage: PropTypes.func, + handleOnChangeMessage: PropTypes.func, placeholder: PropTypes.string, disabledInput: PropTypes.bool, autofocus: PropTypes.bool diff --git a/src/components/Widget/components/Conversation/index.js b/src/components/Widget/components/Conversation/index.js index 4fee8d370..61556e03e 100644 --- a/src/components/Widget/components/Conversation/index.js +++ b/src/components/Widget/components/Conversation/index.js @@ -19,6 +19,7 @@ const Conversation = props => profileAvatar={props.profileAvatar} /> ); } @@ -59,7 +60,8 @@ Widget.propTypes = { fullScreenMode: PropTypes.bool, badge: PropTypes.number, autofocus: PropTypes.bool, - customLauncher: PropTypes.func + customLauncher: PropTypes.func, + handleOnChangeMessage: PropTypes.func }; export default connect()(Widget); diff --git a/src/components/Widget/layout.js b/src/components/Widget/layout.js index 05d449401..14e3396a3 100644 --- a/src/components/Widget/layout.js +++ b/src/components/Widget/layout.js @@ -25,6 +25,7 @@ const WidgetLayout = props => ( disabledInput={props.disabledInput} autofocus={props.autofocus} titleAvatar={props.titleAvatar} + handleOnChangeMessage={props.handleOnChangeMessage} /> } {props.customLauncher ? @@ -52,7 +53,8 @@ WidgetLayout.propTypes = { fullScreenMode: PropTypes.bool, badge: PropTypes.number, autofocus: PropTypes.bool, - customLauncher: PropTypes.func + customLauncher: PropTypes.func, + handleOnChangeMessage: PropTypes.func, }; export default connect(store => ({ diff --git a/src/index.js b/src/index.js index 753c51b10..b51e6e44e 100644 --- a/src/index.js +++ b/src/index.js @@ -19,6 +19,7 @@ const ConnectedWidget = props => badge={props.badge} autofocus={props.autofocus} customLauncher={props.launcher} + handleOnChangeMessage={props.handleOnChangeMessage} /> ; @@ -33,7 +34,8 @@ ConnectedWidget.propTypes = { fullScreenMode: PropTypes.bool, badge: PropTypes.number, autofocus: PropTypes.bool, - launcher: PropTypes.func + launcher: PropTypes.func, + handleOnChangeMessage: PropTypes.func, }; ConnectedWidget.defaultProps = {