diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-17 09:57:09 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2025-11-17 09:57:09 +0100 |
| commit | e95cf5c7b6a08eb560763d5167fbddc1c2117bcc (patch) | |
| tree | 2f7815c9f39328fcaced2113de727f63e4837fa3 /static/widgets/upload-bar/index.js | |
| parent | 0016aaa197697ec5ff38dfb3f63ac8b6f74b48e0 (diff) | |
add file uploading and multi-threading
Diffstat (limited to 'static/widgets/upload-bar/index.js')
| -rw-r--r-- | static/widgets/upload-bar/index.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/static/widgets/upload-bar/index.js b/static/widgets/upload-bar/index.js new file mode 100644 index 0000000..a9e0220 --- /dev/null +++ b/static/widgets/upload-bar/index.js @@ -0,0 +1,42 @@ +import * as sfw from 'sfw'; +const { Div } = sfw.element.native; + +const css = await sfw.css(import.meta.url, './index.css') + +export default class UploadBar extends sfw.element.Container { + #files_progress + #inner_progress + #container + + constructor() { + super({ css }); + + this.body.append( + this.#container = Div.new({ + id: 'container', + style: { display: 'none' }, + children: [ + this.#files_progress = Div.new({ id: 'files', innerText: 'Uploading...' }), + Div.new({ + id: 'inner-progress', + children: [ + this.#inner_progress = Div.new({ id: 'progress' }), + ] + }) + ] + }) + ); + } + + set progress(progress) { + this.#inner_progress.style.width = `${progress * 100}%` + } + + hide() { + this.#container.style.display = 'none'; + } + + show() { + this.#container.style.display = ''; + } +} |