drop.chapril.org-firefoxsend/app/ui/copyDialog.js

30 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-10-26 03:55:11 +02:00
const html = require('choo/html');
const { copyToClipboard } = require('../utils');
2018-10-29 17:52:24 +01:00
module.exports = function(name, url) {
2018-10-26 03:55:11 +02:00
return function(state, emit, close) {
return html`
2018-10-29 17:52:24 +01:00
<div class="flex flex-col items-center text-center p-4 max-w-md">
<h1 class="font-normal my-4">${state.translate('notifyUploadDone')}</h1>
<p class="font-light text-grey-darker">${state.translate(
'copyUrlFormLabelWithName',
{ filename: name }
)}</p>
2018-10-31 19:31:17 +01:00
<input type="text" id="share-url" class="w-full my-4 border rounded leading-loose" value=${url} readonly="true"/>
2018-10-26 03:55:11 +02:00
<button class="border rounded bg-blue text-white leading-loose w-full" onclick=${copy}>
${state.translate('copyUrlFormButton')}
</button>
2018-10-29 17:52:24 +01:00
<a class="text-blue my-2 cursor-pointer" onclick=${close}>${state.translate(
'okButton'
)}</a>
2018-10-26 03:55:11 +02:00
</div>`;
function copy(event) {
event.stopPropagation();
copyToClipboard(url);
event.target.textContent = state.translate('copiedUrl');
setTimeout(close, 1000);
}
};
};