blob: e76aed7dd245db769fb614b67e385f27bbe2a627 [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" />
Pokey Rulee2a8c2f2025-04-23 15:09:25 +01005 <script type="module" src="../sketch-chat-input.ts"
Sean McCullough71941bd2025-04-18 13:31:48 -07006 ></script>
Sean McCullough86b56862025-04-18 13:04:03 -07007
8 <script>
9 document.addEventListener("DOMContentLoaded", () => {
Sean McCullough71941bd2025-04-18 13:31:48 -070010 const chatInput = document.querySelector("sketch-chat-input");
Sean McCullough86b56862025-04-18 13:04:03 -070011 console.log("chatInput: ", chatInput);
12 chatInput.content = "hi";
13 chatInput.addEventListener("send-chat", (evt) => {
Sean McCullough71941bd2025-04-18 13:31:48 -070014 console.log("send chat event: ", evt);
Sean McCullough86b56862025-04-18 13:04:03 -070015 const msgDiv = document.querySelector("#chat-messages");
16 const newDiv = document.createElement("div");
Sean McCullough71941bd2025-04-18 13:31:48 -070017 newDiv.innerText = evt.detail.message;
Sean McCullough86b56862025-04-18 13:04:03 -070018 msgDiv.append(newDiv);
Sean McCullough71941bd2025-04-18 13:31:48 -070019 chatInput.content = "";
Sean McCullough86b56862025-04-18 13:04:03 -070020 });
21 });
22 </script>
Sean McCullough86b56862025-04-18 13:04:03 -070023 </head>
24 <body>
25 <h1>sketch-chat-input demo</h1>
26
27 <div id="chat-messages"></div>
28
29 <sketch-chat-input></sketch-chat-input>
Sean McCullough86b56862025-04-18 13:04:03 -070030 </body>
Sean McCullough71941bd2025-04-18 13:31:48 -070031</html>