15781: Fixes project tag add/delete error handling.
[arvados.git] / src / views-components / context-menu / actions / file-viewer-action.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from "react";
6 import { ListItemIcon, ListItemText, ListItem } from "@material-ui/core";
7 import { OpenIcon } from "~/components/icon/icon";
8
9 export const FileViewerAction = (props: { href?: any, download?: any, onClick?: () => void, kind?: string, currentCollectionUuid?: string; }) => {
10     const fileProps = props.download ? { download: props.download } : {};
11
12     return props.href
13         ? <a
14             style={{ textDecoration: 'none' }}
15             href={props.href}
16             target="_blank"
17             onClick={props.onClick}
18             {...fileProps}>
19             <ListItem button>
20                     <ListItemIcon>
21                         <OpenIcon />
22                     </ListItemIcon>
23                 <ListItemText>
24                     Open in new tab
25                 </ListItemText>
26             </ListItem>
27         </a>
28         : null;
29 };