Skip to content

Instantly share code, notes, and snippets.

@abdullahoguk
Created January 22, 2017 10:52
Show Gist options
  • Save abdullahoguk/da73418b3efd1f52391e37bf9dc3b95c to your computer and use it in GitHub Desktop.
Save abdullahoguk/da73418b3efd1f52391e37bf9dc3b95c to your computer and use it in GitHub Desktop.
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