[Client] ✌️

This commit is contained in:
syuilo 2017-03-13 14:23:29 +09:00
parent fa651a24e3
commit a26236cade
2 changed files with 25 additions and 7 deletions

View file

@ -12,6 +12,7 @@
this.mixin('ui-progress'); this.mixin('ui-progress');
this.mixin('stream'); this.mixin('stream');
this.mixin('get-post-summary'); this.mixin('get-post-summary');
this.mixin('open-post-form');
this.unreadCount = 0; this.unreadCount = 0;
@ -19,6 +20,10 @@
document.title = 'Misskey' document.title = 'Misskey'
this.ui.trigger('title', '<i class="fa fa-home"></i>ホーム'); this.ui.trigger('title', '<i class="fa fa-home"></i>ホーム');
this.ui.trigger('func', () => {
this.openPostForm();
}, 'pencil');
this.Progress.start(); this.Progress.start();
this.stream.on('post', this.onStreamPost); this.stream.on('post', this.onStreamPost);

View file

@ -5,7 +5,7 @@
<div class="content"> <div class="content">
<button class="nav" onclick={ parent.toggleDrawer }><i class="fa fa-bars"></i></button> <button class="nav" onclick={ parent.toggleDrawer }><i class="fa fa-bars"></i></button>
<h1 ref="title">Misskey</h1> <h1 ref="title">Misskey</h1>
<button class="post" onclick={ post }><i class="fa fa-pencil"></i></button> <button if={ func } onclick={ func }><i class="fa fa-{ funcIcon }"></i></button>
</div> </div>
</div> </div>
<style> <style>
@ -74,7 +74,7 @@
> i > i
transition all 0.2s ease transition all 0.2s ease
> .post > button:last-child
display block display block
position absolute position absolute
top 0 top 0
@ -89,14 +89,27 @@
</style> </style>
<script> <script>
this.mixin('ui'); this.mixin('ui');
this.mixin('open-post-form');
this.ui.on('title', title => { this.func = null;
if (this.refs.title) this.refs.title.innerHTML = title; this.funcIcon = null;
this.on('unmount', () => {
this.ui.off('title', this.setTitle);
this.ui.off('func', this.setFunc);
}); });
this.post = () => { this.setTitle = title => {
this.openPostForm(); this.refs.title.innerHTML = title;
}; };
this.setFunc = (fn, icon) => {
this.update({
func: fn,
funcIcon: icon
});
};
this.ui.on('title', this.setTitle);
this.ui.on('func', this.setFunc);
</script> </script>
</mk-ui-header> </mk-ui-header>