2018-10-25 04:07:10 +02:00
|
|
|
const html = require('choo/html');
|
2018-11-12 20:13:31 +01:00
|
|
|
const Component = require('choo/component');
|
|
|
|
const Account = require('./account');
|
2019-01-08 22:50:47 +01:00
|
|
|
const { browserName } = require('../utils');
|
2018-10-25 04:07:10 +02:00
|
|
|
|
2018-11-12 20:13:31 +01:00
|
|
|
class Header extends Component {
|
|
|
|
constructor(name, state, emit) {
|
|
|
|
super(name);
|
|
|
|
this.state = state;
|
|
|
|
this.emit = emit;
|
|
|
|
this.account = state.cache(Account, 'account');
|
|
|
|
}
|
|
|
|
|
|
|
|
update() {
|
|
|
|
this.account.render();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
createElement() {
|
2019-01-08 22:50:47 +01:00
|
|
|
const title =
|
|
|
|
browserName() === 'android-app'
|
|
|
|
? html`
|
|
|
|
<a class="header-logo">
|
|
|
|
<h1 class="text-white md:text-black font-normal">
|
|
|
|
Firefox <b>Send</b>
|
|
|
|
</h1>
|
|
|
|
</a>
|
|
|
|
`
|
|
|
|
: html`
|
|
|
|
<a class="header-logo" href="/">
|
|
|
|
<h1 class="text-white md:text-black font-normal">
|
|
|
|
Firefox <b>Send</b>
|
|
|
|
</h1>
|
|
|
|
</a>
|
|
|
|
`;
|
2018-11-12 20:13:31 +01:00
|
|
|
return html`
|
|
|
|
<header
|
|
|
|
class="relative flex-none flex flex-row items-center justify-between bg-blue md:bg-white w-full px-6 h-16 md:shadow z-20"
|
|
|
|
>
|
2019-01-08 22:50:47 +01:00
|
|
|
${title} ${this.account.render()}
|
2018-11-12 20:13:31 +01:00
|
|
|
</header>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Header;
|