openreplay/frontend/app/components/Session_/Player/Controls/Time.js
2022-06-10 17:11:14 +02:00

23 lines
539 B
JavaScript

import React from 'react';
import { Duration } from 'luxon';
import { connectPlayer } from 'Player';
import styles from './time.module.css';
const Time = ({ time, isCustom, format = 'm:ss', }) => (
<div className={ !isCustom ? styles.time : undefined }>
{ Duration.fromMillis(time).toFormat(format) }
</div>
)
Time.displayName = "Time";
const ReduxTime = connectPlayer((state, { name, format }) => ({
time: state[ name ],
format,
}))(Time);
ReduxTime.displayName = "ReduxTime";
export default Time;
export { ReduxTime };