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

Timer #24

Merged
merged 1 commit into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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} />)