// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; import { WithStyles, StyleRulesCallback, Theme, withStyles, IconButton, Popover, Paper, List, Checkbox, ListItemText, ListItem } from '@material-ui/core'; import ColumnsIcon from "@material-ui/icons/ViewWeek"; import { Column } from '../column'; import { PopoverOrigin } from '@material-ui/core/Popover'; export interface ColumnsConfiguratorProps { columns: Array>; onColumnToggle: (column: Column) => void; } class ColumnsConfigurator extends React.Component> { state = { anchorEl: undefined }; transformOrigin: PopoverOrigin = { vertical: "top", horizontal: "right", }; render() { const { columns, onColumnToggle } = this.props; return ( <> { columns.map((column, index) => ( onColumnToggle(column)}> {column.header} )) } ); } handleClose = () => { this.setState({ anchorEl: undefined }); } handleClick = (event: React.MouseEvent) => { this.setState({ anchorEl: event.currentTarget }); } } type CssRules = "root"; const styles: StyleRulesCallback = (theme: Theme) => ({ root: {} }); export default withStyles(styles)(ColumnsConfigurator);