Skip to content

Commit

Permalink
fix(components): fix dropdown not disappearing after selection (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentlp authored Jul 11, 2022
1 parent 143d21a commit bf999be
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/webchat/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@botpress/messaging-components",
"version": "0.4.0",
"version": "0.4.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"source": "src/index.tsx",
Expand Down
2 changes: 1 addition & 1 deletion packages/webchat/components/src/renderer/choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class SingleChoice extends Component<MessageTypeHandlerProps<'single-choi
return (
<div>
{this.props.text}
{shouldDisplay && <Prepend keyboard={keyboard}>{this.props.children}</Prepend>}
{shouldDisplay && <Prepend keyboard={keyboard} />}
</div>
)
}
Expand Down
11 changes: 8 additions & 3 deletions packages/webchat/components/src/renderer/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const Dropdown = ({
)}
</div>

{displayInKeyboard && (
{buttonText && (
<button className="bpw-button" onClick={sendChoice}>
{buttonText}
</button>
Expand All @@ -85,8 +85,13 @@ export const Dropdown = ({
text = <p>{message}</p>
}

if (displayInKeyboard) {
return <Prepend keyboard={renderSelect(true)}>{text}</Prepend>
if (shouldDisplay && displayInKeyboard) {
return (
<div>
{text}
<Prepend keyboard={renderSelect(true)} />
</div>
)
}

return (
Expand Down
2 changes: 1 addition & 1 deletion packages/webchat/webchat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"dependencies": {
"@blueprintjs/core": "^3.54.0",
"@botpress/messaging-components": "0.4.0",
"@botpress/messaging-components": "0.4.2",
"@botpress/messaging-socket": "1.2.0",
"@formatjs/intl-pluralrules": "^4.3.3",
"@formatjs/intl-utils": "^3.8.4",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2666,7 +2666,7 @@ __metadata:
languageName: unknown
linkType: soft

"@botpress/[email protected].0, @botpress/messaging-components@workspace:packages/webchat/components":
"@botpress/[email protected].2, @botpress/messaging-components@workspace:packages/webchat/components":
version: 0.0.0-use.local
resolution: "@botpress/messaging-components@workspace:packages/webchat/components"
dependencies:
Expand Down Expand Up @@ -3268,7 +3268,7 @@ __metadata:
resolution: "@botpress/webchat@workspace:packages/webchat/webchat"
dependencies:
"@blueprintjs/core": ^3.54.0
"@botpress/messaging-components": 0.4.0
"@botpress/messaging-components": 0.4.2
"@botpress/messaging-socket": 1.2.0
"@botpress/testing": 1.0.0
"@formatjs/intl-pluralrules": ^4.3.3
Expand Down

0 comments on commit bf999be

Please sign in to comment.