Skip to content

Commit

Permalink
Merge pull request #3 from minggas/fix/change-alarm-sound-src
Browse files Browse the repository at this point in the history
fix: change alarm file src
  • Loading branch information
minggas authored Jul 1, 2019
2 parents f7d7a40 + 6f60fa8 commit e158dd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Timer from "./components/Timer";
import Buttons from "./components/Buttons";
import Footer from "./components/Footer";
import "./App.css";
import alarm from "./default.mp3";

class App extends Component {
constructor(props) {
Expand All @@ -15,7 +16,7 @@ class App extends Component {
"session-length": 25,
"break-length": 5,
running: false,
isSession: true
isSession: true,
};
}

Expand All @@ -28,22 +29,22 @@ class App extends Component {
if (e.target.textContent === "-" && this.state[value] > 1) {
this.setState({
[value]: this.state[value] - 1,
countdown: this.state.countdown - 60
countdown: this.state.countdown - 60,
});
} else if (e.target.textContent === "+" && this.state[value] < 60) {
this.setState({
[value]: this.state[value] + 1,
countdown: this.state.countdown + 60
countdown: this.state.countdown + 60,
});
}
} else {
if (e.target.textContent === "-" && this.state[value] > 1) {
this.setState({
[value]: this.state[value] - 1
[value]: this.state[value] - 1,
});
} else if (e.target.textContent === "+" && this.state[value] < 60) {
this.setState({
[value]: this.state[value] + 1
[value]: this.state[value] + 1,
});
}
}
Expand All @@ -64,7 +65,7 @@ class App extends Component {
intervalID: setInterval(() => {
this.runTime();
this.timerControl();
}, 1000)
}, 1000),
});
};

Expand Down Expand Up @@ -97,7 +98,7 @@ class App extends Component {
switchTimer = (num, str) => {
this.setState({
countdown: num,
isSession: str
isSession: str,
});
};

Expand All @@ -108,7 +109,7 @@ class App extends Component {
running: false,
isSession: true,
countdown: 1500,
intervalID: null
intervalID: null,
});
this.state.intervalID && clearInterval(this.state.intervalID);
this.audioBeep.pause();
Expand Down Expand Up @@ -136,7 +137,7 @@ class App extends Component {
<audio
id="beep"
preload="auto"
src="https://onlineclock.net/audio/options/default.mp3"
src={alarm}
ref={audio => {
this.audioBeep = audio;
}}
Expand Down
Binary file added src/default.mp3
Binary file not shown.

0 comments on commit e158dd3

Please sign in to comment.