1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-13 22:54:15 +01:00
send/android/pages/upload.js
2018-11-16 12:39:36 -08:00

27 lines
647 B
JavaScript

const html = require('choo/html');
export default function progressBar(state, emit) {
let percent = 0;
if (state.transfer && state.transfer.progress) {
percent = Math.floor(state.transfer.progressRatio * 100);
}
function onclick(e) {
e.preventDefault();
if (state.uploading) {
emit('cancel');
}
emit('pushState', '/');
}
return html`
<body>
<div id="white">
<div class="card">
<div>${percent}%</div>
<span class="progress" style="width: ${percent}%">.</span>
<div class="cancel" onclick="${onclick}">CANCEL</div>
</div>
</div>
</body>
`;
}