import React from 'react'
import useCountDown from '@/utils/hooks/useCountDown'

export default (props) => {
  const { endTime } = props
  const CountDown = useCountDown(endTime, new Date())

  return (
    <view className='CountDown'>
      <text>距离结束还有</text>
      <text className='Red'>{CountDown[1]||0}</text>
      <text>天</text>
      <text className='Number' style={{ marginLeft: '40rpx' }}>{CountDown[2]||0}</text>
      <text className='active'>时</text>
      <text className='Number'>{CountDown[3]||0}</text>
      <text className='active'>分</text>
      <text className='Number'>{CountDown[4]||0}</text>
      <text className='active'>秒</text>
    </view>
  )
}
