-
Notifications
You must be signed in to change notification settings - Fork 511
/
Copy pathassistant.js
40 lines (33 loc) · 992 Bytes
/
assistant.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import React, { useState, useCallback, useEffect } from "react";
import styles from "./assistant.module.css";
import Modal from "./Modal";
const Assistant = () => {
const [assistantVisible, setAssistantVisible] = useState(false);
const showAssistant = useCallback(() => {
setAssistantVisible(true);
}, []);
const hideAssistant = useCallback(() => {
setAssistantVisible(false);
}, []);
return (
<>
<div className={styles.AskButtonContainer}>
<button className={styles.AskButton} onClick={showAssistant}>
<i className={styles.AskIcon}>forum</i> Ask AI
</button>
</div>
{assistantVisible && (
<Modal
closeDialog={hideAssistant}
contentClassName={styles.IframeWrapper}
>
<iframe
className={styles.Iframe}
src="https://st-assistant.streamlit.app/~/+/?embed=true"
></iframe>
</Modal>
)}
</>
);
};
export default Assistant;