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

47 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-10-25 04:07:10 +02:00
const html = require('choo/html');
const Component = require('choo/component');
const Account = require('./account');
2019-01-24 00:10:09 +01:00
const { platform } = require('../utils');
2018-10-25 04:07:10 +02: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() {
const title =
2019-01-24 00:10:09 +01:00
platform() === 'android'
? html`
<a class="header-logo">
2019-01-16 21:38:43 +01:00
<h1 class="text-2xl text-white md:text-black font-normal">
Firefox <b>Send</b>
</h1>
</a>
`
: html`
<a class="header-logo" href="/">
2019-01-16 21:38:43 +01:00
<h1 class="text-2xl text-white md:text-black font-normal">
Firefox <b>Send</b>
</h1>
</a>
`;
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"
>
${title} ${this.account.render()}
</header>
`;
}
}
module.exports = Header;