-
-
Save whitneyburton/72154fed23f6017bf0cdd852ae3df542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
constructor(props) { | |
super(props); | |
this.state = { | |
open: true, | |
}; | |
} | |
const toggleDemo = () => { | |
if (this.state.open) { | |
this.setState({ open: false }); | |
} else { | |
this.setState({ open: true }); | |
} | |
}; | |
// componentDidMount() { | |
// console.log('componentDidMount - rendered!'); | |
// channel.sendMessage({ | |
// text: 'Welcome to our customer chat with React Hooks tutorial!', | |
// }); | |
// }; | |
// componentWillUnmount() { | |
// console.log(`You have ${channel.state.messages.length} stored in local state. Goodbye!`); | |
// }; | |
return ( | |
<div className={`wrapper ${this.state.open ? 'wrapper--open' : ''}`}> | |
<Chat client={chatClient} theme={'commerce dark'}> | |
<Channel channel={channel}> | |
<Window> | |
<ChannelHeader /> | |
{this.state.open && ( | |
<MessageList | |
typingIndicator={TypingIndicator} | |
Message={MessageCommerce} | |
/> | |
)} | |
<MessageInput Input={MessageInputFlat} /> | |
</Window> | |
</Channel> | |
</Chat> | |
<Button onClick={this.toggleDemo} open={this.state.open} /> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment