send/app/templates/header/index.js

31 lines
1,013 B
JavaScript
Raw Normal View History

const html = require('choo/html');
2018-10-01 21:20:26 +00:00
const userAccount = require('../../templates/userAccount');
2018-09-28 14:54:23 +00:00
const version = require('../../../package.json').version;
const { browserName } = require('../../utils');
2018-10-01 21:20:26 +00:00
module.exports = function(state, emit) {
2018-09-28 14:54:23 +00:00
const browser = browserName();
const feedbackUrl = `https://qsurvey.mozilla.com/s3/txp-firefox-send?ver=${version}&browser=${browser}`;
2018-02-16 20:56:53 +00:00
const header = html`
<header class="header">
2018-10-10 01:17:40 +00:00
<h1><a href="/">Firefox Send</a></h1>
<div class="header__controls">
${userAccount(state, emit)}
<a href="${feedbackUrl}"
rel="noreferrer noopener"
class="feedback"
alt="Feedback"
target="_blank">${state.translate('siteFeedback')}
</a>
</div>
</header>`;
// HACK
// We only want to render this once because we
// toggle the targets of the links with utils/openLinksInNewTab
header.isSameNode = function(target) {
return target && target.nodeName && target.nodeName === 'HEADER';
};
return header;
2018-02-16 20:56:53 +00:00
};