17782: Fixes almost all tests (4 left) mostly by fixing namespace-type imports.
[arvados-workbench2.git] / src / components / refresh-button / refresh-button.tsx
1
2 // Copyright (C) The Arvados Authors. All rights reserved.
3 //
4 // SPDX-License-Identifier: AGPL-3.0
5
6 import React from 'react';
7 import classNames from 'classnames';
8 import { withRouter, RouteComponentProps } from 'react-router';
9 import { StyleRulesCallback, Button, WithStyles, withStyles } from "@material-ui/core";
10 import { ReRunProcessIcon } from 'components/icon/icon';
11
12 type CssRules = 'button' | 'buttonRight';
13
14 const styles: StyleRulesCallback<CssRules> = theme => ({
15     button: {
16         boxShadow: 'none',
17         padding: '2px 10px 2px 5px',
18         fontSize: '0.75rem'
19     },
20     buttonRight: {
21         marginLeft: 'auto',
22     },
23 });
24
25 export const RefreshButton = ({ history, classes }: RouteComponentProps & WithStyles<CssRules>) =>
26     <Button
27         color="primary"
28         size="small"
29         variant="contained"
30         onClick={() => {
31             history.replace(window.location.pathname);
32         }}
33         className={classNames(classes.buttonRight, classes.button)}>
34         <ReRunProcessIcon />
35         Refresh
36     </Button>;
37
38 export default withStyles(styles)(withRouter(RefreshButton));