1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import Drawer from '@material-ui/core/Drawer';
7 import IconButton from "@material-ui/core/IconButton";
8 import CloseIcon from '@material-ui/icons/Close';
9 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
10 import { ArvadosTheme } from '../../common/custom-theme';
11 import Tabs from '@material-ui/core/Tabs';
12 import Tab from '@material-ui/core/Tab';
13 import Typography from '@material-ui/core/Typography';
14 import Grid from '@material-ui/core/Grid';
15 import * as classnames from "classnames";
17 export interface DetailsPanelProps {
18 onCloseDrawer: () => void;
22 class DetailsPanel extends React.Component<DetailsPanelProps & WithStyles<CssRules>, {}> {
27 handleChange = (event: any, value: boolean) => {
28 this.setState({ tabsValue: value });
31 renderTabContainer = (children: React.ReactElement<any>) =>
32 <Typography className={this.props.classes.tabContainer} component="div">
37 const { classes, onCloseDrawer, isOpened } = this.props;
38 const { tabsValue } = this.state;
40 <div className={classnames([classes.container, { [classes.opened]: isOpened }])}>
41 <Drawer variant="permanent" anchor="right" classes={{ paper: classes.drawerPaper }}>
42 <Typography component="div" className={classes.headerContainer}>
43 <Grid container alignItems='center' justify='space-around'>
44 <Typography variant="title">
47 <IconButton color="inherit" onClick={onCloseDrawer}>
52 <Tabs value={tabsValue} onChange={this.handleChange}>
53 <Tab disableRipple label="Details" />
54 <Tab disableRipple label="Activity" />
56 {tabsValue === 0 && this.renderTabContainer(
58 <Grid item xs={6} sm={4} className={classes.gridLabel}>
64 <Grid item xs={6} sm={4}>
72 {tabsValue === 1 && this.renderTabContainer(
74 <Grid item xs={6} sm={4} className={classes.gridLabel}>
80 <Grid item xs={6} sm={4}>
95 type CssRules = 'drawerPaper' | 'container' | 'opened' | 'headerContainer'
96 | 'tabContainer' | 'tabSelected' | 'gridLabel';
98 const drawerWidth = 320;
99 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
102 position: 'relative',
104 transition: 'width 0.5s ease',
111 position: 'relative',
115 color: theme.palette.grey["600"],
116 margin: `${theme.spacing.unit}px 0`
119 padding: theme.spacing.unit * 3
123 color: theme.palette.grey["500"]
127 export default withStyles(styles)(DetailsPanel);