Skip to content
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

feat: countdown component #74

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open

Conversation

ZanBin
Copy link
Contributor

@ZanBin ZanBin commented Nov 17, 2023

Summary

Features

Bugs

Check List

  • Your code builds clean without any errors or warnings.
  • Check coding convention.
  • Updated Storybook components and stories to reflect any changes made to the UI.
  • Test covers all edge cases and coverage is greater than or equal to 80%.

Proof of Completeness

simulator_screenshot_730EAD0B-DD83-463B-9982-DEBFE4D24578
simulator_screenshot_EBF960C9-F1F2-467C-8458-976842983757

src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
@loc-nguyenthien loc-nguyenthien changed the title Feature/countdown component feat: countdown component Nov 17, 2023
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
@ZanBin ZanBin force-pushed the feature/countdown-component branch from 6e6ec76 to 5c8eef5 Compare November 21, 2023 08:36
src/components/CountDown/CountDown.tsx Outdated Show resolved Hide resolved
src/theme/components/Countdown/Countdown.ts Outdated Show resolved Hide resolved
@ZanBin ZanBin force-pushed the feature/countdown-component branch from 2bf7e3c to dcbd740 Compare November 24, 2023 08:44
/*
caculate minutes
*/
const resultCaculatMinute = Math.floor(seconds / numberSecondPerMinute) % numberSecondPerMinute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong typo

Suggested change
const resultCaculatMinute = Math.floor(seconds / numberSecondPerMinute) % numberSecondPerMinute
const resultCaculateMinute = Math.floor(seconds / numberSecondPerMinute) % numberSecondPerMinute

caculate minutes
*/
const resultCaculatMinute = Math.floor(seconds / numberSecondPerMinute) % numberSecondPerMinute
const minute = resultCaculatMinute >= 0 ? resultCaculatMinute : 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it need to be >= 0 ? shouldn't it be only > 0

if resultCaculateMinute = 0, it will be same as the value return from else condition

caculate seconds
*/
const resultCaculatSecond = Math.round(seconds % numberSecondPerMinute)
const second = resultCaculatSecond >= 0 ? resultCaculatSecond : 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with const minute

*/
if (FormatTime.ddhhmmss === FormatTime[format]) {
const resultCaculatDay = Math.floor(seconds / secondPerDay)
const day = resultCaculatDay >= 0 ? resultCaculatDay : 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here


return (
<Container style={[CountDownTheme.containerStyle, containerStyle]}>
{textDay && textDay}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it convert to Boolean, because textDay has case = null, so if it return null it will return error string outside Text component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants