/** * @flow * @file Versions Item Actions component * @author Box */ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import DropdownMenu from '../../../components/dropdown-menu'; import IconClockPast from '../../../icons/general/IconClockPast'; import IconDownload from '../../../icons/general/IconDownload'; import IconEllipsis from '../../../icons/general/IconEllipsis'; import IconOpenWith from '../../../icons/general/IconOpenWith'; import IconTrash from '../../../icons/general/IconTrash'; import IconUpload from '../../../icons/general/IconUpload'; import messages from './messages'; import PlainButton from '../../../components/plain-button'; import Tooltip from '../../../components/tooltip/Tooltip'; import VersionsItemAction from './VersionsItemAction'; import { Menu } from '../../../components/menu'; import './VersionsItemActions.scss'; type Props = { fileId: string, isCurrent?: boolean, isRetained?: boolean, onDelete?: () => void, onDownload?: () => void, onPreview?: () => void, onPromote?: () => void, onRestore?: () => void, showDelete?: boolean, showDownload?: boolean, showPreview?: boolean, showPromote?: boolean, showRestore?: boolean, }; const handleMenuClose = (event: SyntheticEvent<> | MouseEvent) => { event.stopPropagation(); }; const handleToggleClick = (event: SyntheticMouseEvent) => { event.stopPropagation(); }; const VersionsItemActions = ({ fileId, isCurrent = false, isRetained = false, onDelete, onDownload, onPreview, onPromote, onRestore, showDelete = false, showDownload = false, showPreview = false, showPromote = false, showRestore = false, }: Props) => { if (!showDelete && !showDownload && !showPreview && !showPromote && !showRestore) { return null; } return ( {(text: string) => {text}} {showPreview && ( )} {showDownload && ( )} {showPromote && ( )} {showRestore && ( )} {showDelete && ( } isTabbable={false} isDisabled={!isRetained} > )} ); }; export default VersionsItemActions;