Skip to content

Commit

Permalink
Merge pull request #50 from mrbot-ai/feature/hide_when_not_connected
Browse files Browse the repository at this point in the history
Feature/hide when not connected
  • Loading branch information
Nathan Zylbersztejn authored Dec 21, 2018
2 parents cc828f8 + 865c84b commit c4abbd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.5.3
- Added the parameter hideWhenNotConnected to not display the widget when the server is not connected (defaults to true)
- Fixed issue where the 'connected' property was being loaded from previous session instead of being triggered on actual connection
- Reduced the size of the widget container on mobile and in fullscreen mode (blocking clicks)

## 0.5.2
- Added support for custom images for open and close buttons of chatWidget interface
Expand Down
7 changes: 6 additions & 1 deletion src/components/Widget/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ const WidgetLayout = (props) => {
}
const showCloseButton = props.showCloseButton !== undefined ? props.showCloseButton : !props.embedded;
const isVisible = props.isChatVisible && !(props.hideWhenNotConnected && !props.connected);
const chatShowing = (props.isChatOpen || props.embedded);

if (chatShowing && !props.embedded) {
classes.push('chat-open');
}

return (
isVisible ?
<div className={classes.join(' ')}>
{
(props.isChatOpen || props.embedded) &&
chatShowing &&
<Conversation
title={props.title}
subtitle={props.subtitle}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Widget/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
align-items: flex-end;
justify-content: flex-end;

&.full-screen {
&.full-screen.chat-open {
@include widget-container-fs;
}
}
Expand All @@ -32,7 +32,7 @@
}

@media screen and (max-width: 800px) {
.widget-container {
.widget-container.chat-open {
@include widget-container-fs;
}
}

0 comments on commit c4abbd0

Please sign in to comment.