import PropTypes from 'prop-types';
import React from 'react';
import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';
import PlainButton from '../../components/plain-button';
import { VersionPropType } from './prop-types';
import messages from './messages';
// @NOTE: Having an identical "key" on the restore and remove button
// allows browser to maintain focus correctly on the link, otherwise it focuses
// body after the links swap. This let's the ESCAPE key work correctly.
const REMOVE_RESTORE_BUTTON_KEY = 'remove-restore-button';
const FileVersionActions = ({
canDelete,
canUpload,
isProcessing,
onDelete,
onDownload,
onMakeCurrent,
onRestore,
version,
}) => {
const btnClasses = classNames('lnk', {
'is-disabled': isProcessing,
});
const renderRestoreButton = () => {
if (version.deleted <= 0 || !onRestore) {
return null;
}
return (