// Copyright (C) 2020 Intel Corporation // // SPDX-License-Identifier: MIT import React, { useState } from 'react'; import { Row, Col } from 'antd/lib/grid'; import Icon from 'antd/lib/icon'; import Slider, { SliderValue } from 'antd/lib/slider'; import Tooltip from 'antd/lib/tooltip'; import InputNumber from 'antd/lib/input-number'; import Text from 'antd/lib/typography/Text'; interface Props { startFrame: number; stopFrame: number; frameNumber: number; inputFrameRef: React.RefObject; onSliderChange(value: SliderValue): void; onInputChange(value: number | undefined): void; onURLIconClick(): void; } function PlayerNavigation(props: Props): JSX.Element { const { startFrame, stopFrame, frameNumber, inputFrameRef, onSliderChange, onInputChange, onURLIconClick, } = props; const [frameInputValue, setFrameInputValue] = useState(frameNumber); return ( <> filename.png { setFrameInputValue( Math.max( Math.min( Number(value), stopFrame, ), startFrame, ), ); }} onBlur={() => { onInputChange(frameInputValue); }} onPressEnter={() => { onInputChange(frameInputValue); }} ref={inputFrameRef} /> ); } export default React.memo(PlayerNavigation);