storm: add reload/end buttons
parent
57d9657f72
commit
e17ad7c8ff
|
@ -2,6 +2,7 @@
|
|||
&__clock {
|
||||
@extend %flex-center-nowrap;
|
||||
|
||||
margin-bottom: -1em;
|
||||
font-family: 'storm';
|
||||
|
||||
&__time {
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
&__combo {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: flex-end;
|
||||
flex: 0 0 25%;
|
||||
|
||||
&__counter {
|
||||
display: flex;
|
||||
|
|
|
@ -25,6 +25,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
&__table {
|
||||
@extend %flex-column;
|
||||
flex: 0 0 25%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
&__control {
|
||||
@extend %flex-center;
|
||||
|
||||
justify-content: flex-end;
|
||||
height: 2.5em;
|
||||
margin-bottom: .2em;
|
||||
|
||||
.button {
|
||||
color: $c-font-dim;
|
||||
padding: .5em 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
&__start {
|
||||
color: $c-brag;
|
||||
margin: auto;
|
||||
|
|
|
@ -3,7 +3,7 @@ import config from '../config';
|
|||
import renderClock from './clock';
|
||||
import renderEnd from "./end";
|
||||
import StormCtrl from '../ctrl';
|
||||
import { getNow } from '../util';
|
||||
import { getNow, onInsert } from '../util';
|
||||
import { h } from 'snabbdom'
|
||||
import { VNode } from 'snabbdom/vnode';
|
||||
|
||||
|
@ -36,10 +36,33 @@ const renderPlay = (ctrl: StormCtrl): VNode[] => [
|
|||
h('div.storm__side', [
|
||||
ctrl.vm.run.startAt ? renderSolved(ctrl) : renderStart(ctrl),
|
||||
renderClock(ctrl),
|
||||
renderCombo(ctrl)
|
||||
h('div.storm__table', [
|
||||
renderControls(ctrl),
|
||||
renderCombo(ctrl)
|
||||
])
|
||||
])
|
||||
];
|
||||
|
||||
const renderControls = (ctrl: StormCtrl): VNode =>
|
||||
h('div.storm__control', [
|
||||
h('a.storm__control__reload.button.button-empty', {
|
||||
attrs: {
|
||||
href: '/storm',
|
||||
'data-icon': 'B',
|
||||
title: 'New run'
|
||||
}
|
||||
}),
|
||||
h('a.storm__control__end.button.button-empty', {
|
||||
attrs: {
|
||||
'data-icon': 'b',
|
||||
title: 'End run',
|
||||
},
|
||||
hook: onInsert(el => el.addEventListener('click', () => {
|
||||
if (ctrl.vm.puzzleStartAt) ctrl.end()
|
||||
}))
|
||||
})
|
||||
]);
|
||||
|
||||
const renderCombo = (ctrl: StormCtrl): VNode => {
|
||||
const level = ctrl.comboLevel();
|
||||
return h('div.storm__combo', [
|
||||
|
|
Loading…
Reference in New Issue