How to use the botframework-webchat.createStyleSet function in botframework-webchat

To help you get started, we’ve selected a few botframework-webchat examples, based on popular ways it is used in public projects.

github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat / chat.tsx View on Github external
const {
      botId,
      currentUser,
      conversationId,
      directLine,
      locale,
      mode,
      webchatStore,
      webSpeechPonyfillFactory,
    } = this.props;

    const isDisabled = mode === 'transcript' || mode === 'debug';

    // Due to needing to make idiosyncratic style changes, Emulator is using `createStyleSet` instead of `createStyleOptions`. The object below: {...webChatStyleOptions, hideSendBox...} was formerly passed into the `styleOptions` parameter of React Web Chat. If further styling modifications are desired using styleOptions, simply pass it into the same object in createStyleSet below.

    const styleSet = createStyleSet({ ...webChatStyleOptions, hideSendBox: isDisabled });

    styleSet.uploadButton = {
      ...styleSet.uploadButton,
      padding: '1px',
    };

    if (this.props.pendingSpeechTokenRetrieval) {
      return <div className={styles.disconnected}>Connecting...</div>;
    }

    if (directLine) {
      const bot = {
        id: botId || 'bot',
        name: 'Bot',
      };
github microsoft / BotFramework-Composer / Composer / packages / client / src / pages / webchat / MinimizableWebchat.js View on Github external
runRpcCommand(rpcCommand);
            // stop webchat redux action propagation
            return;
          }
        }
      }

      return next(action);
    });

    this.state = {
      minimized: true,
      newMessage: false,
      side: 'right',
      store,
      styleSet: createStyleSet({
        backgroundColor: 'Transparent',
      }),
      token: props.token,
    };
  }
github microsoft / BotFramework-Emulator / packages / app / client / src / ui / editor / emulator / parts / chat / chat.spec.tsx View on Github external
it('renders the WebChat component with correct props', () => {
      const webChat = wrapper.find(ReactWebChat);
      const styleSet = createStyleSet({ ...webChatStyleOptions });

      styleSet.uploadButton = {
        ...styleSet.uploadButton,
        padding: '1px',
      };

      expect(webChat.exists()).toBe(true);
      expect(webChat.props()).toMatchObject({
        activityMiddleware: expect.any(Function),
        bot: { id: defaultDocument.botId, name: 'Bot' },
        directLine: defaultDocument.directLine,
        locale: 'en-US',
        styleSet: styleSet,
        userID: '123',
        username: 'Current User',
      });
github microsoft / BotFramework-WebChat / samples / 12.customization-minimizable-web-chat / src / MinimizableWebChat.js View on Github external
}, 1000);
      } else if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {
        if (action.payload.activity.from.role === 'bot') {
          this.setState(() => ({ newMessage: true }));
        }
      }

      return next(action);
    });

    this.state = {
      minimized: true,
      newMessage: false,
      side: 'right',
      store,
      styleSet: createStyleSet({
        backgroundColor: 'Transparent'
      }),
      token: null
    };
  }
github microsoft / BotFramework-WebChat / samples / 12.customization-minimizable-web-chat / src / WebChat.js View on Github external
constructor(props) {
    super(props);

    this.createDirectLine = memoize(token => createDirectLine({ token }));

    this.state = {
      styleSet: createStyleSet({
        backgroundColor: 'Transparent'
      })
    };
  }
github microsoft / BotFramework-Composer / Composer / packages / client / src / pages / webchat / WebChat.js View on Github external
constructor(props) {
    super(props);

    this.createDirectLine = memoize(token => createDirectLine({ token }));

    this.state = {
      styleSet: createStyleSet({
        backgroundColor: 'Transparent',
      }),
    };
  }