mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
27 lines
688 B
TypeScript
27 lines
688 B
TypeScript
import { MaybeNumber, TimerPhase } from 'ontime-types';
|
|
import { millisToString } from 'ontime-utils';
|
|
|
|
import { cx, timerPlaceholder } from '../../../../common/utils/styleUtils';
|
|
|
|
import style from './TimerDisplay.module.scss';
|
|
|
|
interface TimerDisplayProps {
|
|
time: MaybeNumber;
|
|
phase: TimerPhase;
|
|
className?: string;
|
|
}
|
|
|
|
/**
|
|
* Displays time in ms in formatted timetag
|
|
* Used in editor
|
|
*/
|
|
export default function TimerDisplay({ time, phase, className }: TimerDisplayProps) {
|
|
const display = millisToString(time, { fallback: timerPlaceholder }).replace('-', '');
|
|
|
|
return (
|
|
<div className={cx([style.timer, className])} data-phase={phase}>
|
|
{display}
|
|
</div>
|
|
);
|
|
}
|