blob: afc79fbe64ce0c320f7df7669cdcdafdc06eb936 [file] [log] [blame]
Sean McCullough86b56862025-04-18 13:04:03 -07001<html>
2 <head>
3 <title>sketch-chat-input demo</title>
4 <link rel="stylesheet" href="demo.css" />
Philip Zeyliger72682df2025-04-23 13:09:46 -07005 <script type="module" src="../sketch-chat-input.ts"></script>
Sean McCullough86b56862025-04-18 13:04:03 -07006
7 <script>
8 document.addEventListener("DOMContentLoaded", () => {
Sean McCullough71941bd2025-04-18 13:31:48 -07009 const chatInput = document.querySelector("sketch-chat-input");
Sean McCullough86b56862025-04-18 13:04:03 -070010 console.log("chatInput: ", chatInput);
11 chatInput.content = "hi";
12 chatInput.addEventListener("send-chat", (evt) => {
Sean McCullough71941bd2025-04-18 13:31:48 -070013 console.log("send chat event: ", evt);
Sean McCullough86b56862025-04-18 13:04:03 -070014 const msgDiv = document.querySelector("#chat-messages");
15 const newDiv = document.createElement("div");
Sean McCullough71941bd2025-04-18 13:31:48 -070016 newDiv.innerText = evt.detail.message;
Sean McCullough86b56862025-04-18 13:04:03 -070017 msgDiv.append(newDiv);
Sean McCullough71941bd2025-04-18 13:31:48 -070018 chatInput.content = "";
Sean McCullough86b56862025-04-18 13:04:03 -070019 });
20 });
21 </script>
Sean McCullough86b56862025-04-18 13:04:03 -070022 </head>
23 <body>
24 <h1>sketch-chat-input demo</h1>
25
26 <div id="chat-messages"></div>
27
28 <sketch-chat-input></sketch-chat-input>
Sean McCullough86b56862025-04-18 13:04:03 -070029 </body>
Sean McCullough71941bd2025-04-18 13:31:48 -070030</html>