aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design/design.css4
-rw-r--r--src/Update/UpdateTimer.elm5
-rw-r--r--src/View/Timer.elm5
3 files changed, 14 insertions, 0 deletions
diff --git a/design/design.css b/design/design.css
index ddf597b..a1a8ce7 100644
--- a/design/design.css
+++ b/design/design.css
@@ -54,6 +54,10 @@ h1 {
width: 100px;
}
+.timer > button.restart {
+ border: none;
+}
+
.timer > button.stop {
border: none;
}
diff --git a/src/Update/UpdateTimer.elm b/src/Update/UpdateTimer.elm
index 40085ed..771ef1c 100644
--- a/src/Update/UpdateTimer.elm
+++ b/src/Update/UpdateTimer.elm
@@ -8,6 +8,7 @@ import Model.Id (..)
type TimerAction =
ToggleRunning
+ | Restart
| Stop
updateTimer : TimerAction -> Timer -> Timer
@@ -15,6 +16,10 @@ updateTimer action timer =
case action of
ToggleRunning ->
{ timer | isRunning <- not timer.isRunning }
+ Restart ->
+ { timer
+ | currentTime <- timer.initialTime
+ }
Stop ->
{ timer
| isRunning <- False
diff --git a/src/View/Timer.elm b/src/View/Timer.elm
index 98f6514..271de5c 100644
--- a/src/View/Timer.elm
+++ b/src/View/Timer.elm
@@ -28,6 +28,11 @@ timerView (id, timer) =
[ class <| "time block" ]
[ text (timeView timer.currentTime) ]
, button
+ [ class <| "restart block"
+ , onClick (Signal.send updates (UpdateTimer id Restart))
+ ]
+ [ i [ class "fa fa-fw fa-backward" ] [] ]
+ , button
[ class <| "stop block"
, onClick (Signal.send updates (UpdateTimer id Stop))
]