Skip to content
Snippets Groups Projects
Select Git revision
  • d3ded9deb2eed98549d0a98b5c1e6b6cb147453f
  • main default protected
  • 24-everything-from-git
  • 45-create-new-poc-deployment-with-docker
  • 44-add-a-cli-tool
  • improve-deployment
  • 31-backend
  • bash-script-bug-fix
  • upgrades_submodules
  • 24-dependencies-build-nested-watch
  • 24-dependencies-build-using-workspaces
  • 24-dependencies-build
  • wip-all-local
  • 10-annotot
  • 3-annotation-plugin-showing-up
15 results

webpack.config.js

Blame
  • WorkspaceSettings.js 2.00 KiB
    import React, { Component } from 'react';
    import Dialog from '@material-ui/core/Dialog';
    import DialogContent from '@material-ui/core/DialogContent';
    import DialogTitle from '@material-ui/core/DialogTitle';
    import FormControl from '@material-ui/core/FormControl';
    import InputLabel from '@material-ui/core/InputLabel';
    import Select from '@material-ui/core/Select';
    import MenuItem from '@material-ui/core/MenuItem';
    import PropTypes from 'prop-types';
    
    /**
     */
    class WorkspaceSettings extends Component {
      /**
       * constructor -
       */
      constructor(props) {
        super(props);
        this.handleThemeChange = this.handleThemeChange.bind(this);
      }
    
      /**
       * Propagate theme selection into the global state
       */
      handleThemeChange(event) {
        const { updateConfig } = this.props;
    
        updateConfig({ theme: event.target.value });
      }
    
      /**
       * render
       * @return
       */
      render() {
        const {
          handleClose, open, children, theme,
        } = this.props;
        return (
          <Dialog id="workspace-settings" open={open} onClose={handleClose}>
            <DialogTitle id="form-dialog-title">Settings</DialogTitle>
            <DialogContent>
              {children}
              <FormControl>
                <InputLabel htmlFor="theme-simple">Theme</InputLabel>
                <Select
                  value={theme}
                  onChange={this.handleThemeChange}
                  inputProps={{
                    name: 'theme',
                    id: 'theme-simple',
                  }}
                >
                  <MenuItem value="light">Light</MenuItem>
                  <MenuItem value="dark">Dark</MenuItem>
                </Select>
              </FormControl>
            </DialogContent>
          </Dialog>
        );
      }
    }
    
    WorkspaceSettings.propTypes = {
      handleClose: PropTypes.func.isRequired,
      open: PropTypes.bool, // eslint-disable-line react/forbid-prop-types
      children: PropTypes.node,
      updateConfig: PropTypes.func.isRequired,
      theme: PropTypes.string.isRequired,
    };
    
    WorkspaceSettings.defaultProps = {
      open: false,
      children: null,
    };
    
    export default WorkspaceSettings;