Skip to content

Commit

Permalink
Add tool box
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGrandchamp committed May 20, 2019
1 parent 3b9988d commit 0b6bc85
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 86 deletions.
63 changes: 63 additions & 0 deletions assets/tools.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 36 additions & 11 deletions dev/App.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
import React, { Component } from 'react';
import { Widget, addResponseMessage, setQuickButtons, toggleMsgLoader } from '../index';
import React, { Component } from "react";
import {
Widget,
addResponseMessage,
setQuickButtons,
toggleMsgLoader
} from "../index";

export default class App extends Component {
componentDidMount() {
addResponseMessage('Welcome to this awesome chat!');
addResponseMessage("Welcome to this awesome chat!");
}

handleNewUserMessage = (newMessage) => {
handleNewUserMessage = newMessage => {
toggleMsgLoader();
setTimeout(() => {
toggleMsgLoader();
if (newMessage === 'fruits') {
setQuickButtons([ { label: 'Apple', value: 'apple' }, { label: 'Orange', value: 'orange' }, { label: 'Pear', value: 'pear' }, { label: 'Banana', value: 'banana' } ]);
toggleMsgLoader();
if (newMessage === "fruits") {
setQuickButtons([
{ label: "Apple", value: "apple" },
{ label: "Orange", value: "orange" },
{ label: "Pear", value: "pear" },
{ label: "Banana", value: "banana" }
]);
} else {
addResponseMessage(newMessage);
}
}, 2000);
}
};

handleQuickButtonClicked = (e) => {
addResponseMessage('Selected ' + e);
handleQuickButtonClicked = e => {
addResponseMessage("Selected " + e);
setQuickButtons([]);
}
};

render() {
return (
Expand All @@ -32,6 +42,21 @@ export default class App extends Component {
handleNewUserMessage={this.handleNewUserMessage}
handleQuickButtonClicked={this.handleQuickButtonClicked}
badge={1}
showCloseButton={true}
menuItems={[
{
label: "HEY MAN",
onClick: () => {
console.log("Malade");
}
},
{
label: "icons",
onClick: () => {
console.log("Malade");
}
}
]}
/>
);
}
Expand Down
28 changes: 21 additions & 7 deletions lib/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b6bc85

Please sign in to comment.