Files
frontend/src/widgets/hero/ui/Countdown.tsx
2026-05-09 00:38:56 +03:00

32 lines
754 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useCountdown } from '../lib/useCountdown'
import styles from './Countdown.module.css'
const UNITS: Array<['d' | 'h' | 'm' | 's', string]> = [
['d', 'ДНЕЙ'],
['h', 'ЧАСОВ'],
['m', 'МИНУТ'],
['s', 'СЕКУНД'],
]
interface Props {
days: number
}
export function Countdown({ days }: Props) {
const cd = useCountdown(days)
return (
<div>
<div className={styles.label}>ДО ЗАПУСКА ОСТАЛОСЬ</div>
<div className={styles.row}>
{UNITS.map(([key, label]) => (
<div key={key} className={styles.unit}>
<div className={styles.num}>{cd[key]}</div>
<div className={styles.lbl}>{label}</div>
</div>
))}
</div>
</div>
)
}