mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 02:13:48 +00:00
67ddcd8c68
* feat/table add react-table * feat/table add protected table route * feat/table upgrade dependencies * feat/table support parsing of new properties Co-authored-by: DeepSource Bot <bot@deepsource.io>
33 lines
790 B
React
33 lines
790 B
React
import React, { memo } from 'react';
|
|
import { formatDisplay } from 'common/utils/dateConfig';
|
|
import PropTypes from 'prop-types';
|
|
import styles from './Countdown.module.css';
|
|
|
|
const Countdown = ({ time, small, isNegative, hideZeroHours }) => {
|
|
// prepare display string
|
|
const display =
|
|
time != null && !isNaN(time)
|
|
? formatDisplay(time, hideZeroHours)
|
|
: '-- : -- : --';
|
|
|
|
const colour = isNegative ? '#ff7597' : '#fffffa';
|
|
|
|
return (
|
|
<div
|
|
className={small ? styles.countdownClockSmall : styles.countdownClock}
|
|
style={{ color: colour }}
|
|
>
|
|
{display}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default memo(Countdown);
|
|
|
|
Countdown.propTypes = {
|
|
time: PropTypes.number,
|
|
small: PropTypes.bool,
|
|
isNegative: PropTypes.bool,
|
|
hideZeroHours: PropTypes.bool,
|
|
};
|