import * as React from 'react'; import {Dropdown} from './Dropdown/Dropdown'; import {CropLabel} from './Dropdown/CropLabel'; import {QualityLabel} from './Dropdown/QualityLabel'; interface IProps { wrapperRef: (element: HTMLDivElement) => void; playPause: () => void; onRotate: () => void; onCrop: (aspect: number) => void; onQualityChange: (quality: number) => void; gettext: (text: string) => string; getClass: (text: string) => string; cropEnabled: boolean; videoPlaying: boolean; videoDegree: number; videoQuality: number; videoHeadline: string; videoResolution: number; } class VideoEditorToolsComponent extends React.PureComponent { render() { const resolutions = [{label: 'Same', value: 0}].concat( [480, 720, 1080] .filter((i) => i < this.props.videoResolution) .map((i) => ({label: i + 'p', value: i})), ); const qualityDisabled = resolutions.length === 1; const cropItems = [[1, 1], [4, 3], [16, 9]].map((i) => { const [x, y] = i; return {label: x + ':' + y, value: x / y}; }); const {getClass, gettext} = this.props; return (
} items={cropItems} onSelect={this.props.onCrop} disabled={this.props.cropEnabled === false} isButton={true} className={getClass('dropdown__crop')} gettext={gettext} /> {this.props.videoHeadline}
{gettext('Quality:')} )} items={resolutions} onSelect={this.props.onQualityChange} disabled={this.props.videoQuality === 0} className={qualityDisabled ? getClass('dropdown__quality--disable') : ''} gettext={gettext} />
); } } export const VideoEditorTools = React.forwardRef((props: IProps, ref: React.Ref) => , );