Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Merge pull request #24 from smooth-code/Timer
Browse files Browse the repository at this point in the history
Timer
  • Loading branch information
gregberge authored Jan 25, 2018
2 parents 10ad550 + 608f55d commit 88cf421
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
14 changes: 14 additions & 0 deletions components/Timer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
import PropTypes from 'prop-types'

const Timer = ({ countdown }) => (
<div>
<span>{countdown}</span>
</div>
)

Timer.propTypes = {
countdown: PropTypes.number,
}

export default Timer
10 changes: 10 additions & 0 deletions components/Timer.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { shallow } from 'enzyme'
import Timer from './Timer'

describe('Timer', () => {
it('should render a timer', () => {
const wrapper = shallow(<Timer countdown={42} />)
expect(wrapper.text()).toEqual('42')
})
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"passport-github2": "^0.1.11",
"pg": "^7.4.1",
"polished": "^1.9.0",
"prop-types": "^15.6.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"styled-components": "^2.4.0"
Expand Down
4 changes: 3 additions & 1 deletion stories/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
// import { action } from '@storybook/addon-actions'
import ProgressBar from '../components/ProgressBar'
import Timer from '../components/Timer'

storiesOf('ProgressBar', module)
.add('0/20', () => <ProgressBar currentQuestion={0} />)
Expand All @@ -12,3 +12,5 @@ storiesOf('ProgressBar', module)
.add('Large', () => <ProgressBar size={800} />)
.add('Without ScoreBox', () => <ProgressBar scoreBox={false} />)
.add('Red', () => <ProgressBar color="#BD4932" />)

storiesOf('Timer', module).add('Basic', () => <Timer countdown={15} />)

0 comments on commit 88cf421

Please sign in to comment.