mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
17a7d035bf
fix: close modal with button refactor: small type improvements refactor: migrate time inputs refactor: migrate tooltips refactor: prevent component resizing
30 lines
813 B
TypeScript
30 lines
813 B
TypeScript
import { IoChevronDown, IoChevronUp } from 'react-icons/io5';
|
|
|
|
import { millisToDelayString } from '../../utils/dateConfig';
|
|
import Tooltip from '../tooltip/Tooltip';
|
|
|
|
import style from './DelayIndicator.module.scss';
|
|
|
|
interface DelayIndicatorProps {
|
|
delayValue?: number;
|
|
tooltipPrefix?: string;
|
|
}
|
|
|
|
export default function DelayIndicator(props: DelayIndicatorProps) {
|
|
const { delayValue, tooltipPrefix } = props;
|
|
|
|
if (typeof delayValue !== 'number' || delayValue === 0) {
|
|
return null;
|
|
}
|
|
|
|
const delayString = tooltipPrefix
|
|
? `${tooltipPrefix} ${millisToDelayString(delayValue)}`
|
|
: millisToDelayString(delayValue);
|
|
|
|
return (
|
|
<Tooltip text={delayString} render={<span />} className={style.delaySymbol}>
|
|
{delayValue < 0 ? <IoChevronDown /> : <IoChevronUp />}
|
|
</Tooltip>
|
|
);
|
|
}
|