blob: 99d581b9cb6ee0be8ddf24ae4dd0529c527221a4 [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" />
Sean McCullough71941bd2025-04-18 13:31:48 -07005 <script
6 src="/dist/web-components/sketch-chat-input.js"
7 type="module"
8 ></script>
Sean McCullough86b56862025-04-18 13:04:03 -07009
10 <script>
11 document.addEventListener("DOMContentLoaded", () => {
Sean McCullough71941bd2025-04-18 13:31:48 -070012 const chatInput = document.querySelector("sketch-chat-input");
Sean McCullough86b56862025-04-18 13:04:03 -070013 console.log("chatInput: ", chatInput);
14 chatInput.content = "hi";
15 chatInput.addEventListener("send-chat", (evt) => {
Sean McCullough71941bd2025-04-18 13:31:48 -070016 console.log("send chat event: ", evt);
Sean McCullough86b56862025-04-18 13:04:03 -070017 const msgDiv = document.querySelector("#chat-messages");
18 const newDiv = document.createElement("div");
Sean McCullough71941bd2025-04-18 13:31:48 -070019 newDiv.innerText = evt.detail.message;
Sean McCullough86b56862025-04-18 13:04:03 -070020 msgDiv.append(newDiv);
Sean McCullough71941bd2025-04-18 13:31:48 -070021 chatInput.content = "";
Sean McCullough86b56862025-04-18 13:04:03 -070022 });
23 });
24 </script>
Sean McCullough86b56862025-04-18 13:04:03 -070025 </head>
26 <body>
27 <h1>sketch-chat-input demo</h1>
28
29 <div id="chat-messages"></div>
30
31 <sketch-chat-input></sketch-chat-input>
Sean McCullough86b56862025-04-18 13:04:03 -070032 </body>
Sean McCullough71941bd2025-04-18 13:31:48 -070033</html>