@@ -26,6 +26,7 @@ import { isDev, msgToBotonic } from '../utils'
26
26
import Logo from './botonic_react_logo100x100.png'
27
27
import EmojiPicker from 'emoji-picker-react'
28
28
import LogoMenu from './menuButton.svg'
29
+ import { Button } from '../components/button'
29
30
30
31
const getScriptBaseURL = ( ) => {
31
32
let scriptBaseURL = document
@@ -172,6 +173,9 @@ export const Webchat = forwardRef((props, ref) => {
172
173
}
173
174
}
174
175
}
176
+ const closeMenu = ( ) => {
177
+ setMenuIsOpened ( false )
178
+ }
175
179
176
180
const sendInput = async input => {
177
181
let inputMessage = null
@@ -397,59 +401,44 @@ export const Webchat = forwardRef((props, ref) => {
397
401
< PersistentMenu >
398
402
{ Object . values ( props . persistentMenu ) . map ( ( e , i ) => {
399
403
return (
400
- < p key = { i } onClick = { ( ) => sendPayload ( e . payload ) } >
404
+ < Button payload = { e . payload } key = { i } >
401
405
{ Object . values ( e . label ) }
402
- </ p >
406
+ </ Button >
403
407
)
404
408
} ) }
409
+ < Button onClick = { closeMenu } > Cancel</ Button >
405
410
</ PersistentMenu >
406
411
) }
407
- { ! webchatState . handoff &&
408
- Object . keys ( props . persistentMenu ) . length != 0 && (
409
- < >
412
+ { ! webchatState . handoff && (
413
+ < div
414
+ style = { {
415
+ display : 'flex' ,
416
+ borderTop : '1px solid rgba(0, 0, 0, 0.4)'
417
+ } }
418
+ >
419
+ { Object . keys ( props . persistentMenu ) . length != 0 && (
410
420
< div
411
421
style = { {
412
422
display : 'flex' ,
413
-
414
- borderTop : '1px solid rgba(0, 0, 0, 0.4)'
423
+ flex : 'none' ,
424
+ width : 50
415
425
} }
416
426
>
417
427
< div style = { { width : 50 } } >
418
428
< img
419
429
style = { {
420
- paddingTop : '14px' ,
430
+ paddingTop : '20px' ,
431
+ paddingBottom : '15px' ,
421
432
marginLeft : '18px' ,
422
- marginRight : '8px'
433
+ marginRight : '8px' ,
434
+ cursor : 'pointer'
423
435
} }
424
436
src = { LogoMenu }
425
437
onClick = { ( ) => handleMenu ( ) }
426
438
/>
427
439
</ div >
428
- < Textarea
429
- name = 'text'
430
- minRows = { 2 }
431
- maxRows = { 4 }
432
- wrap = 'soft'
433
- maxLength = '1000'
434
- placeholder = { webchatState . theme . textPlaceholder }
435
- autoFocus = { location . hostname === 'localhost' }
436
- inputRef = { textArea }
437
- onKeyDown = { e => onKeyDown ( e ) }
438
- style = { {
439
- display : 'flex' ,
440
- padding : '8px 10px' ,
441
- fontSize : 14 ,
442
- border : 'none' ,
443
- resize : 'none' ,
444
- overflow : 'auto' ,
445
- outline : 'none'
446
- } }
447
- />
448
440
</ div >
449
- </ >
450
- ) }
451
- { ! webchatState . handoff &&
452
- Object . keys ( props . persistentMenu ) . length === 0 && (
441
+ ) }
453
442
< Textarea
454
443
name = 'text'
455
444
minRows = { 2 }
@@ -462,16 +451,17 @@ export const Webchat = forwardRef((props, ref) => {
462
451
onKeyDown = { e => onKeyDown ( e ) }
463
452
style = { {
464
453
display : 'flex' ,
465
- padding : '8px 10px' ,
454
+ paddingLeft : '10px' ,
466
455
fontSize : 14 ,
467
456
border : 'none' ,
468
457
resize : 'none' ,
469
458
overflow : 'auto' ,
470
459
outline : 'none' ,
471
- borderTop : '1px solid rgba(0, 0, 0, 0.4) '
460
+ marginTop : '13px '
472
461
} }
473
462
/>
474
- ) }
463
+ </ div >
464
+ ) }
475
465
{ webchatState . webview && (
476
466
< RequestContext . Provider value = { webviewRequestContext } >
477
467
< WebviewContainer
0 commit comments