Skip to content

Commit

Permalink
Allow changing the time interval
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeesilcock committed May 7, 2015
1 parent 378f5fe commit 389be65
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/actions/timer_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import Reflux from 'reflux';
var Actions = Reflux.createActions([
'start',
'pause',
'reset'
'reset',
'minutesChanged'
]);

export default Actions;
7 changes: 6 additions & 1 deletion src/components/interval.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React from 'react';
import TimerControl from './timer_control';
import PeopleActions from '../actions/people_actions';
import TimerActions from '../actions/timer_actions';

class Interval extends React.Component {
handleChange(event) {
TimerActions.minutesChanged(event.target.value);
}

render() {
return (
<div>
<input type="text" value={this.props.minutes} />
<input type="text" defaultValue={this.props.minutes} onChange={this.handleChange.bind(this)} />
<TimerControl state={this.props.state} />
</div>
);
Expand Down
7 changes: 6 additions & 1 deletion src/stores/timer_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var Store = Reflux.createStore({

init() {
this.data = {
minutes: 0.1,
minutes: 30,
msLeft: 0,
end: 0,
state: 'idle' // idle -> running -> paused
Expand Down Expand Up @@ -46,6 +46,11 @@ var Store = Reflux.createStore({
this.trigger();
},

onMinutesChanged(minutes) {
this.data.minutes = minutes;
this.trigger();
},

// Internal

scheduleUpdate() {
Expand Down
3 changes: 3 additions & 0 deletions src/styles/main.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.people {
list-style: none;
padding: 0;

li.active {
font-weight: bold;
}
Expand Down

0 comments on commit 389be65

Please sign in to comment.