2018-10-25 02:07:10 +00:00
|
|
|
const html = require('choo/html');
|
2018-11-12 19:13:31 +00:00
|
|
|
const Component = require('choo/component');
|
|
|
|
const Account = require('./account');
|
2019-01-23 23:10:09 +00:00
|
|
|
const { platform } = require('../utils');
|
2018-10-25 02:07:10 +00:00
|
|
|
|
2018-11-12 19:13:31 +00: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 21:50:47 +00:00
|
|
|
const title =
|
2019-01-23 23:10:09 +00:00
|
|
|
platform() === 'android'
|
2019-01-08 21:50:47 +00:00
|
|
|
? html`
|
|
|
|
<a class="header-logo">
|
2019-02-11 21:48:06 +00:00
|
|
|
<h1 class="text-3xl text-white md:text-black font-normal">
|
|
|
|
<b>Firefox</b> Send
|
2019-01-08 21:50:47 +00:00
|
|
|
</h1>
|
|
|
|
</a>
|
|
|
|
`
|
|
|
|
: html`
|
|
|
|
<a class="header-logo" href="/">
|
2019-02-11 21:48:06 +00:00
|
|
|
<h1 class="text-3xl text-white md:text-black font-normal">
|
|
|
|
<b>Firefox</b> Send
|
2019-01-08 21:50:47 +00:00
|
|
|
</h1>
|
|
|
|
</a>
|
|
|
|
`;
|
2018-11-12 19:13:31 +00:00
|
|
|
return html`
|
|
|
|
<header
|
2019-02-11 21:48:06 +00:00
|
|
|
class="relative flex-none flex flex-row items-center justify-between bg-black w-full px-6 h-16 z-20 md:bg-transparent"
|
2018-11-12 19:13:31 +00:00
|
|
|
>
|
2019-01-08 21:50:47 +00:00
|
|
|
${title} ${this.account.render()}
|
2018-11-12 19:13:31 +00:00
|
|
|
</header>
|
|
|
|
`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Header;
|