layouts
All repositories: gitoria
2.5 KB
// components/showcase/files-upload-pick.hl — `/components/files-upload-pick`: the upload component in PICK mode (components ticket #18):// dropped, chosen, pasted (Ctrl+V) or photographed files are only collected, as thumbnails and rows; ✕ takes one away. It is ONE box: the// text field, the files right under it, and the footer: the small "Choose files" button at the left, Send at the right end. THE PAGE OWNS THE// LIST: it binds `files = attached`, hears every change through `onChange`, and at Send shows the message and empties the list. The// showcase sends nothing anywhere (the files stay in the browser). One FilesUpload per page, so this is a page of its own.parent '../main.hl'import SiteHeader from '../site-header.hl'import SiteSidebar from '../site-sidebar.hl'import ContentFirst from '../../theme/shell/content-first.hl'import TheFilesUpload from '../files-upload/files-upload.hl'import { namesOf } from '../../lib/pick.hl'__title = 'File upload, pick first · WorldAPI layouts'Hybrid attached = []Hybrid sent = []String state = ''picked = (list) => { attached = list }View {showFilesUploadPick {SiteHeader { current = "/components/files-upload-pick" }ContentFirst {SiteSidebar { current = "/components/files-upload-pick" }main {h1 { "File upload, pick first" }p { class = "muted" "A chat input in one box: type, and drop, paste (Ctrl+V), choose or photograph files — they wait under the text as thumbnails and rows, ✕ takes one away. Nothing is sent until Send (and here nothing leaves the browser). Up to 2 MB per file." }ol { id = "sent" for (m of sent) { li { p { class = "sent-text" m.text } p { class = "sent-files" m.files } } } }TheFilesUpload { mode = "pick" files = attached onChange = picked maxSize = 2097152form { id = "chat-form" on submit(e) { emit chatSend(e) }textarea { id = "chat-text" name = "text" rows = "2" placeholder = "Write a message…" 'aria-label' = "Message" }button { type = "submit" id = "chat-send" "Send" }}}p { class = "muted" output { id = "chat-state" state } }p { class = "readme links" a { href = "/read/readme-files-upload" "README of the component (how an app uses it)" } }}}}}on chatSend(e) {e.preventDefault()form = e.targettext = form.querySelector('textarea').valueif (text.trim() == '' && attached.length == 0) { return null }sent.push({ text = text files = attached.length + ' files: ' + namesOf(attached) })attached = []form.reset()state = 'Sent'}
Branches
Latest commits
- 97110ad9WIP: nest accepted layout selectors; stopped at startup parse failuremre
- ce4a0baeKeep caller slot styles whole so minimal shell apps startmre
- 12cd3992Re-vendor complete Hybriel plugins and runtime to day44mre
- b05c20feBackup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 8d9ed0b8Re-vendor complete Hybriel plugins and runtime to day39mre
- ebd00b6cNest caller slot styles in three-panemre
- 009991efNest caller slot styles in list-firstmre
- 494d75d4Nest caller slot styles in app-sidebarmre
- e5571680Align all plugin sources with Hybriel day38bmre
- 5d204c46Re-vendor layouts to Hybriel set day38bmre
- 17e0f03eNest html-prefixed theme component overridesmre
- e54e735eFormat plain theme elements with nested rules and bare mediamre
- 547f834eRecord LY7 deployment and live verificationmre
- fa4600b1Link caller-slot style exceptions to hybriel#270mre
- 413b11e1Record corrected LY7 nesting, exact CSS and Chrome proofmre
- b810453etracker-demo: nest child and compound selectors in Stylemre
- 0b5b1d61notes-demo: nest child and compound selectors in Stylemre
- ab22bdc2mail-demo: nest child and compound selectors in Stylemre
- fe2d8de9home: nest child and compound selectors in Stylemre
- e631791buser-menu: nest child and compound selectors in Stylemre