Created
January 22, 2017 10:52
-
-
Save abdullahoguk/da73418b3efd1f52391e37bf9dc3b95c to your computer and use it in GitHub Desktop.
This file contains 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, { Component, PropTypes, constructor, State } from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { createContainer } from 'meteor/react-meteor-data'; | |
import Flexbox from 'flexbox-react'; | |
import ReactCountdownClock from "react-countdown-clock"; | |
export default class Counter extends Component { | |
constructor(props) { | |
super(props); | |
console.log('Counter Loaded..'); | |
} | |
getTimeRemaining(startTime){ | |
var t = Date.parse(new Date()) - Date.parse(startTime); | |
var seconds = Math.floor( (t/1000) % 60 ); | |
var minutes = Math.floor( (t/1000/60) % 60 ); | |
var hours = Math.floor( (t/(1000*60*60)) % 24 ); | |
var days = Math.floor( t/(1000*60*60*24) ); | |
return { | |
'total': t, | |
'days': days, | |
'hours': hours, | |
'minutes': minutes, | |
'seconds': seconds | |
}; | |
} | |
render() { | |
/* | |
if user.profile.startTime = -1 | |
set startTime to >>> Date.parse(new Date()) | |
return | |
<ReactCountdownClock seconds={25*60} color="#000" alpha={0.5} size={350} font="freeSans" onComplete={function(){console.log("bitti");}} /> | |
else | |
start = startTime in db; | |
remaining = getTimeRemaining(start); | |
if (remaining.days && remaining.hours = 0){ | |
return <ReactCountdownClock seconds={(remaining.minutes*60) + remaining.seconds } color="#000" alpha={0.5} size={350} font="freeSans" onComplete={function(){console.log("bitti");}} /> | |
} | |
*/ | |
return | |
<Flexbox className="timerCont"> | |
<ReactCountdownClock seconds={25*60} color="#000" alpha={0.5} size={350} font="freeSans" onComplete={function(){console.log("bitti");}} /> | |
</Flexbox> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment