Skip to content
Snippets Groups Projects
DataBrowser.jsx 1.36 KiB
Newer Older
  • Learn to ignore specific revisions
  • import React from 'react'
    import { withStyles } from '@material-ui/core/styles'
    
    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'
    
    
    const styles = theme => ({
    
      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)
    
        this.state = {
          viewType: props.viewType
    
      handleViewTypeChange(viewType) {
        this.setState({ viewType })
      }
    
    
      render() {
        const { viewType } = this.state
        const { classes } = this.props
    
        return (
    
          <div className={classes.boundary}>
            <Toolbar viewType={viewType} onViewTypeChange={this.handleViewTypeChange} />
            {viewType === 'list' && <ListView />}
            {viewType === 'grid' && <GridView />}
    
    vkovtun's avatar
    vkovtun committed
    export default withStyles(styles)(DataBrowser)