renderButtons()

in src/components/Widget/components/Conversation/components/Messages/components/Buttons/index.js [43:91]


  renderButtons(message, buttons, persit) {
    const { isLast, linkTarget, separateButtons
    } = this.props;
    const { userTextColor, userBackgroundColor } = this.context;
    const buttonStyle = {
      color: userTextColor,
      backgroundColor: userBackgroundColor,
      borderColor: userBackgroundColor
    };
    return (
      <div>
        <Message message={message} />
        {separateButtons && (<div className="rw-separator" />) }
        {(isLast || persit) && (
          <div className="rw-replies">
            {buttons.map((reply, index) => {
              if (reply.get('type') === 'web_url') {
                return (
                  <a
                    key={index}
                    href={reply.get('url')}
                    target={linkTarget || '_blank'}
                    rel="noopener noreferrer"
                    className={'rw-reply'}
                    style={buttonStyle}
                    onMouseUp={e => e.stopPropagation()}
                  >
                    {reply.get('title')}
                  </a>
                );
              }
              return (
                // eslint-disable-next-line jsx-a11y/no-static-element-interactions
                <div
                  key={index}
                  className={'rw-reply'}
                  onClick={(e) => { e.stopPropagation(); this.handleClick(reply); }}
                  style={buttonStyle}
                  onMouseUp={e => e.stopPropagation()}
                >
                  {reply.get('title')}
                </div>
              );
            })}
          </div>
        )}
      </div>
    );
  }