[Frontend] Styling for Timer

Fixes #623
Mod to code to allow timerState to be accessible
to markup; CSS for stop button and paused/stopped states
This commit is contained in:
Charles Hacskaylo 2017-01-26 11:57:08 -08:00
parent 8750bdd778
commit 4072b91808
3 changed files with 53 additions and 19 deletions

View File

@ -1,33 +1,36 @@
.l-time-display { .l-time-display {
$transTime: 200ms; $transTime: 200ms;
$controlSize: 14px;
$control1ControlW: $controlSize + $interiorMargin;
$control2ControlW: $control1ControlW * 2;
line-height: 140%; line-height: 140%;
&:hover { &:hover {
.l-btn.control { .l-btn.controls {
opacity: 1; opacity: 1;
} }
} }
&.l-timer { &.l-timer {
.l-value:before,
.control {
font-size: 0.8em;
}
.l-value:before { .l-value:before {
// Direction +/- element // Direction +/- element
font-size: $controlSize;
margin-right: $interiorMarginSm; margin-right: $interiorMarginSm;
} }
.control { .controls {
@include trans-prop-nice((width, opacity), $transTime); @include trans-prop-nice((width, opacity), $transTime);
font-size: $controlSize;
line-height: inherit; line-height: inherit;
margin-right: 0; margin-right: 0;
opacity: 0; opacity: 0;
width: 0; width: 0;
.flex-elem {
margin-right: $interiorMargin;
}
} }
&:hover .control { &:hover .controls {
margin-right: $interiorMargin;
opacity: 1; opacity: 1;
width: 1em; width: $control2ControlW;
} }
} }
@ -35,4 +38,34 @@
color: pullForward($colorBodyFg, 50%); color: pullForward($colorBodyFg, 50%);
font-weight: 400; font-weight: 400;
} }
// States
&.s-state-stopped,
&.s-state-paused {
.l-value {
opacity: 0.4;
}
}
&.s-state-started {
.l-value {
opacity: 1;
}
}
&.s-state-stopped {
// Hide Stop button, 1controlW
.t-btn-stop {
display: none;
}
&:hover .controls { width: $control1ControlW; }
}
&.s-state-paused {
// Paused, do something visual
.l-value {
&:before { @extend .pulse; }
}
}
} }

View File

@ -19,15 +19,16 @@
this source code distribution or the Licensing information page available this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information. at runtime from the About dialog for additional information.
--> -->
<div class="l-time-display l-digital l-timer s-timer" ng-controller="TimerController as timer"> <div class="l-time-display l-digital l-timer s-timer s-state-{{timer.timerState}}" ng-controller="TimerController as timer">
<div class="l-elem-wrapper l-flex-row"> <div class="l-elem-wrapper l-flex-row">
<a ng-click="timer.clickButton()" <div class="l-elem-wrapper l-flex-row controls">
title="{{timer.buttonText()}}" <a ng-click="timer.clickStopButton()"
class="flex-elem control s-icon-button {{timer.buttonCssClass()}}"></a> title="Stop"
<a ng-click="timer.clickStopButton()" class="flex-elem s-icon-button t-btn-stop icon-box"></a>
title="{{timer.stopButtonText()}}" <a ng-click="timer.clickButton()"
class="{{!timer.stopButtonCssClass() || 'flex-elem control s-icon-button'}} {{timer.stopButtonCssClass()}}"></a> title="{{timer.buttonText()}}"
<span class="flex-elem l-value {{timer.stateClass()}}"></span> class="flex-elem s-icon-button t-btn-pauseplay {{timer.buttonCssClass()}}"></a>
</div>
<span class="flex-elem l-value {{timer.signClass()}}"> <span class="flex-elem l-value {{timer.signClass()}}">
<span class="value" <span class="value"
ng-class="{ active:timer.text() }">{{timer.text() || "--:--:--"}} ng-class="{ active:timer.text() }">{{timer.text() || "--:--:--"}}

View File

@ -73,7 +73,7 @@ define(
} }
function updateTimerState(timerState) { function updateTimerState(timerState) {
relativeTimerState = timerState; self.timerState = relativeTimerState = timerState;
} }
function updateActions(actionCapability, actionKey) { function updateActions(actionCapability, actionKey) {