Download task_022/solution/code/index.html from Lego-X/UXInteract: direct link, hf CLI and curl.
- Browser
- Download file 3.59 kB
-
https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_022/solution/code/index.html
- Command line
-
hf download hf://datasets/Lego-X/UXInteract/task_022/solution/code/index.html
-
curl -L -o index.html https://huggingface.co/datasets/Lego-X/UXInteract/resolve/main/task_022/solution/code/index.html
3.59 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Floating Prompt Area</title> | |
| <style> | |
| * { box-sizing: border-box; } | |
| body { font-family: system-ui, sans-serif; margin: 0; background: #f5f6f8; color: #1a1a1a; | |
| min-height: 140vh; padding-bottom: 140px; } | |
| header { padding: 16px 24px; background: #fff; border-bottom: 1px solid #e3e6ea; } | |
| .chat-history { max-width: 760px; margin: 24px auto; padding: 0 16px; display: flex; | |
| flex-direction: column; gap: 12px; } | |
| .chat-message { padding: 10px 14px; border-radius: 12px; max-width: 70%; } | |
| .chat-message.user { align-self: flex-end; background: #d7e9ff; } | |
| .chat-message.bot { align-self: flex-start; background: #fff; border: 1px solid #e3e6ea; } | |
| /* | |
| floating-prompt-area refactor: | |
| previously this area displayed messages that were already sent (history). | |
| It now hosts a REUSABLE input in a pending (waiting-to-send) state. | |
| The floating behavior (fixed at the bottom) and the rounded-corner | |
| logic are preserved. | |
| */ | |
| .floating-prompt-area { | |
| position: fixed; | |
| left: 50%; | |
| bottom: 80px; | |
| transform: translateX(-50%); | |
| width: min(720px, calc(100vw - 32px)); | |
| background: #fff; | |
| border: 1px solid #ccd2da; | |
| box-shadow: 0 8px 24px rgba(0,0,0,0.12); | |
| padding: 10px 12px; | |
| display: flex; | |
| gap: 8px; | |
| align-items: center; | |
| } | |
| /* rounded / corner logic kept on the floating area */ | |
| .floating-prompt-area.rounded { border-radius: 18px; } | |
| .prompt-input { | |
| flex: 1; | |
| border: none; | |
| outline: none; | |
| font-size: 15px; | |
| padding: 12px 8px; | |
| background: transparent; | |
| } | |
| .send-btn { border: none; background: #2563eb; color: #fff; border-radius: 12px; | |
| padding: 10px 18px; cursor: pointer; font-size: 15px; } | |
| </style> | |
| </head> | |
| <body> | |
| <header><strong>Conversation</strong></header> | |
| <div class="chat-history" id="history"> | |
| <div class="chat-message bot">Hello! How can I help?</div> | |
| <div class="chat-message user">Please refactor the floating input area.</div> | |
| <div class="chat-message bot">Done. The input area is now ready for a new message.</div> | |
| </div> | |
| <!-- floating prompt area now contains the reusable pending input, not sent messages --> | |
| <div class="floating-prompt-area rounded" data-testid="floating-prompt-area" data-state="pending"> | |
| <input class="prompt-input" data-testid="reusable-prompt-input" | |
| placeholder="Type a message..." aria-label="prompt input"> | |
| <button class="send-btn" id="send" data-testid="send-button">Send</button> | |
| </div> | |
| <script> | |
| window.__setComposerCorners=mode=>document.querySelector('[data-testid=floating-prompt-area]').classList.toggle('rounded',mode==='rounded'); | |
| const input = document.querySelector('[data-testid="reusable-prompt-input"]'); | |
| const history = document.getElementById('history'); | |
| function send() { | |
| const text = input.value.trim(); | |
| if (!text) return; // empty input never appends | |
| const msg = document.createElement('div'); | |
| msg.className = 'chat-message user'; | |
| msg.setAttribute('data-testid', 'chat-message-user'); | |
| msg.textContent = text; | |
| history.appendChild(msg); // append the new user bubble | |
| input.value = ''; // clear the reusable pending input | |
| } | |
| document.getElementById('send').addEventListener('click', send); | |
| input.addEventListener('keydown', (e) => { | |
| if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); send(); } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |