This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "open-json-api", | |
| "version": "1.0.0", | |
| "description": "A Life Rest Api using Json-Server, and Hosted on Heroku", | |
| "main": "index.js", | |
| "scripts": { | |
| "start": "node index.js" | |
| }, | |
| "dependencies": { | |
| "json-server": "^0.8.21", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Timer from "./components/Timer"; | |
| import './App.css'; | |
| export { | |
| Timer | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import Clock from './Clock'; | |
| import Input from './Input'; | |
| import Button from './Button'; | |
| class Timer extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| count: 0, | |
| running: false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| class Input extends React.Component { | |
| onSubmit(event) { | |
| event.preventDefault(); | |
| const strSeconds = this.refs.seconds.value; | |
| if(strSeconds.match(/[0-9]/)) { | |
| this.refs.seconds.value = ''; | |
| this.props.onSetCountdown(parseInt(strSeconds, 10)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @import url('https://fonts.googleapis.com/css?family=Ubuntu:400,700'); | |
| * { | |
| box-sizing: border-box; | |
| } | |
| body { | |
| margin: 0; | |
| filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#211a4c', endColorstr='#8200ff',GradientType=1 ); | |
| height: 100vh; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| class Clock extends React.Component { | |
| format(time) { | |
| let seconds = time % 60; | |
| let minutes = Math.floor(time / 60); | |
| minutes = minutes.toString().length === 1 ? "0" + minutes : minutes; | |
| seconds = seconds.toString().length === 1 ? "0" + seconds : seconds; | |
| return minutes + ':' + seconds; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import {Timer} from "../lib"; | |
| class App extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <Timer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import App from "./examples/App"; | |
| ReactDOM.render(<App />, document.getElementById("root")); |
NewerOlder