-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] - Add Timer #33
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! Left some minor comments.
src/components/Timer/Timer.tsx
Outdated
const [minutes, setMintues] = React.useState(0); | ||
const [seconds, setSeconds] = React.useState(-5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like prefixing state variables with s
to quickly identify them when reading through the code so these would become sMinutes
and sSeconds
.
src/components/Timer/Timer.tsx
Outdated
{minutes < 10 ? 0 : ''} | ||
{minutes}:{seconds < 10 ? 0 : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use something like padStart
from lodash to handle adding these zeros for you.
src/components/Timer/Timer.tsx
Outdated
<h1> | ||
{minutes < 10 ? 0 : ''} | ||
{minutes}:{seconds < 10 ? 0 : ''} | ||
{seconds < 0 ? Math.abs(seconds) : seconds} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since lookup time will always be at a maximum 15 seconds, could we only show seconds there. eg. when seconds state is negative we only show seconds
and once its positive, it goes to minutes:seconds
.
.eslintrc.js
Outdated
"prettier/prettier": ["error", { | ||
"endOfLine":"auto" | ||
}], | ||
'no-console': 'off', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might be able to get rid of this line. I'm not seeing any consoles that would require turning it off.
Best reviewed: commit by commit
Optimal code review plan (1 warning, 2 commits squashed)
|
Description
Add timer
Fixes
Fix #6