fox-send/app/ui/header.js

40 lines
987 B
JavaScript
Raw Permalink Normal View History

2018-10-25 02:07:10 +00:00
const html = require('choo/html');
const Component = require('choo/component');
const Account = require('./account');
2019-02-19 21:13:14 +00:00
const assets = require('../../common/assets');
2019-01-23 23:10:09 +00:00
const { platform } = require('../utils');
2018-10-25 02:07:10 +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() {
const title =
2019-01-23 23:10:09 +00:00
platform() === 'android'
? html`
2019-02-19 21:13:14 +00:00
<a class=""><img src="${assets.get('logo.svg')}"/></a>
`
: html`
2019-02-19 21:13:14 +00:00
<a class="" href="/"><img src="${assets.get('logo.svg')}"/></a>
`;
return html`
<header
2019-02-22 20:00:39 +00:00
class="relative flex-none flex flex-row items-center justify-between w-full px-6 h-16 md:h-24 z-20 bg-transparent"
>
${title} ${this.account.render()}
</header>
`;
}
}
module.exports = Header;