16812: Handoff token using query param
[arvados-workbench2.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 import { sanitizeToken } from "./helpers";
9
10 export const FileViewerAction = (props: { href?: any, download?: any, onClick?: () => void, kind?: string, currentCollectionUuid?: string; }) => {
11
12     return props.href
13         ? <a
14             style={{ textDecoration: 'none' }}
15             href={sanitizeToken(props.href, true)}
16             target="_blank"
17             onClick={props.onClick}>
18             <ListItem button>
19                 <ListItemIcon>
20                     <OpenIcon />
21                 </ListItemIcon>
22                 <ListItemText>
23                     Open in new tab
24                  </ListItemText>
25             </ListItem>
26         </a>
27         : null;
28 };