add cancel buttons

This commit is contained in:
Emily 2018-07-31 15:19:18 -07:00
parent c9ae76b209
commit 4c64593262
9 changed files with 72 additions and 31 deletions

View file

@ -4,14 +4,6 @@ const assets = require('../../../common/assets');
module.exports = function(state) {
const footer = html`<footer class="footer">
<div class="legalSection">
<a
href="https://www.mozilla.org"
class="legalSection__link">
<img
class="legalSection__mozLogo"
src="${assets.get('mozilla-logo.svg')}"
alt="mozilla"/>
</a>
<a
href="https://www.mozilla.org/about/legal"
class="legalSection__link">
@ -38,6 +30,16 @@ module.exports = function(state) {
class="legalSection__link">
${state.translate('reportIPInfringement')}
</a>
<a
href="https://www.mozilla.org"
class="legalSection__link">
<img
class="legalSection__mozLogo"
src="${assets.get('mozilla-logo.svg')}"
alt="mozilla"/>
</a>
<a
href="https://github.com/mozilla/send"
class="socialSection__link">
@ -50,9 +52,9 @@ module.exports = function(state) {
href="https://twitter.com/FxTestPilot"
class="socialSection__link">
<img
class="legalSection__mozLogo"
src="${assets.get('mozilla-logo.svg')}"
alt="mozilla"/>
class="socialSection__icon"
src="${assets.get('twitter-icon.svg')}"
alt="twitter"/>
</a>
</div>
</footer>`;

View file

@ -6,23 +6,20 @@ const fileIcon = require('../fileIcon');
module.exports = function(file, state, emit) {
const transfer = state.transfer;
const transferState = transfer ? transfer.state : null;
const transferring = state.uploading || state.downloading;
const share = state.route.includes('share/');
const complete = share ? 'uploadedFile--completed' : '';
const cancelVisible =
transferring || state.route === '/' ? 'uploadedFile__cancel--visible' : '';
state.route === '/' && !state.uploading
? 'uploadedFile__cancel--visible'
: '';
const stampClass =
share || transferState === 'complete' ? 'uploadedFile__stamp--visible' : '';
function cancel(event) {
event.preventDefault();
const btn = document.querySelector('.uploadedFile__cancel');
btn.disabled = true;
if (transferring) {
emit('cancel');
} else if (state.route === '/') {
if (state.route === '/') {
emit('removeUpload', { file });
}
}