Newer
Older
import React from 'react'
import { withStyles } from '@material-ui/core/styles'
vkovtun
committed
import autoBind from 'auto-bind'
import Toolbar from '@src/js/components/database/data-browser/Toolbar.jsx'
import ListView from '@src/js/components/database/data-browser/ListView.jsx'
import GridView from '@src/js/components/database/data-browser/GridView.jsx'
containerDefault: {
padding: `${theme.spacing(1)}px ${theme.spacing(2)}px`
},
containerSquare: {
padding: `${theme.spacing(2)}px ${theme.spacing(2)}px`
},
boundary: {
padding: theme.spacing(1),
borderWidth: '2px',
borderStyle: 'solid',
borderColor: theme.palette.border.secondary,
backgroundColor: theme.palette.background.paper
}
})
class DataBrowser extends React.Component {
constructor(props, context) {
super(props, context)
vkovtun
committed
autoBind(this)
this.state = {
viewType: props.viewType
vkovtun
committed
handleViewTypeChange(viewType) {
this.setState({ viewType })
}
render() {
const { viewType } = this.state
const { classes } = this.props
return (
vkovtun
committed
<div className={classes.boundary}>
<Toolbar viewType={viewType} onViewTypeChange={this.handleViewTypeChange} />
{viewType === 'list' && <ListView />}
{viewType === 'grid' && <GridView />}
</div>
)
}