import React from 'react'; import styled from 'styled-components'; import Countdown, {CountdownRenderProps} from 'react-countdown'; interface ProgressCountdownProps { base: Date; deadline: Date; hideBar?: boolean; description: string; } const ProgressCountdown: React.FC = ({base, deadline, hideBar, description}) => { const percentage = Date.now() >= deadline.getTime() ? 100 : ((Date.now() - base.getTime()) / (deadline.getTime() - base.getTime())) * 100; const countdownRenderer = (countdownProps: CountdownRenderProps) => { const {days, hours, minutes, seconds} = countdownProps; const h = String(days * 24 + hours); const m = String(minutes); const s = String(seconds); return ( {h.padStart(2, '0')}:{m.padStart(2, '0')}:{s.padStart(2, '0')} ); }; return ( // {/* {description} */} {hideBar ? ( '' ) : ( )} // ); }; const StyledCountdown = styled.p` // font-size: 14px; font-weight: 700; // color: ${(props) => props.theme.color.grey[100]}; margin: 0 0 6px 0; `; const StyledProgressOuter = styled.div` width: 100%; height: 8px; border-radius: 3px; background: ${(props) => props.theme.color.grey[700]}; `; const StyledProgress = styled.div<{progress: number}>` width: ${(props) => props.progress}%; height: 100%; border-radius: 3px; background: ${(props) => props.theme.color.grey[100]}; `; const StyledCardContentInner = styled.div` height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; // padding: ${(props) => props.theme.spacing[2]}px ${(props) => props.theme.spacing[4]}px; `; export default ProgressCountdown;