Skip to content

mia-js/react-count-down

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-count-down

react-count-down is a simple count down component using react.

Installation

npm install git+https://git@github.com/7factory/react-count-down.git --save-dev

Usage

import Countdown from 'react-count-down'
import ReactDOM from 'react-dom'
import React from 'react'
import Moment from 'moment'

const _addSomeTime = () => {
  return Moment().add(1, 'minutes').format('MM/DD/YYYY h:mm A')
}

let options = {
  endDate: _addSomeTime(),
  prefix: 'until resetting countdown!',
  reset: true,
  expiredMessage: 'RESET'
}
const cb = () => {
  options['endDate'] = _addSomeTime()
  console.log(`resetting countdown with new end date ${options.endDate}`)
}
options['cb'] = cb

const TestComponent = () => (
  <div>
    <Countdown options={{
      endDate: '07/15/2019 10:55 AM', prefix: 'until my birthday!', cb: () => {
        console.log('expired callback')
      }
    }}/>
    <Countdown options={options}/>
  </div>
)

ReactDOM.render(<TestComponent/>, document.getElementById('root'))

Styles

react-count-down can be used with your own custom styles. A minimal countdown.css style sheet is included as a guide.

Development

npm install
npm run build
npm test
npm start

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published