2018-08-16 18:07:12 +02:00
|
|
|
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', '/');
|
|
|
|
}
|
2018-11-16 21:39:36 +01:00
|
|
|
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>
|
|
|
|
`;
|
2018-08-16 18:07:12 +02:00
|
|
|
}
|