content: 'use babel'
  
  import React from 'react';
  import ReactDom from 'react-dom';
  import fs from 'fs';
  
  import regenerateIndex from './regenerateIndex';
  
  function genMod(name){
    const modulesPath = `${atom.project.getPaths()[0]}/src/modules`;
    fs.mkdirSync(`${modulesPath}/${name}`);
  
    fs.mkdirSync(`${modulesPath}/${name}/actions`);
    regenerateIndex(`${modulesPath}/${name}/actions`);
  
    fs.mkdirSync(`${modulesPath}/${name}/components`);
    regenerateIndex(`${modulesPath}/${name}/components`);
  
    fs.mkdirSync(`${modulesPath}/${name}/libs`);
    fs.writeFileSync(`${modulesPath}/${name}/libs/constants.js`, `
  'use babel'
  export default {
  
  };
    `);
    regenerateIndex(`${modulesPath}/${name}/libs`);
  
    fs.writeFileSync(`${modulesPath}/${name}/defaultState.js`, `
  'use babel'
  export default {
  
  };
    `);
    regenerateIndex(`${modulesPath}/${name}`);
  
    regenerateIndex(modulesPath);
  };
  
  
  class CreateModule extends React.Component {
  
      constructor(props) {
        super(props);
        this.submit = this.submit.bind(this);
        this.state = {
          error: false,
        }
      }
  
      submit(value) {
        genMod(value);
        this.props.panel.destroy();
        return false;
      }
      render() {
        return (
          <div>
            <h1> Create New Module </h1>
            <label style={{padding: "1em"}} for="signature">Name</label>
            <input onKeyPress={(e) => {(e.key === 'Enter') ? this.submit(e.target.value) : ''}} type="text" id="signature" />
          </div>
        )
      }
  }
  
  export default function() {
    const element = document.createElement("div");
    const panel = atom.workspace.addModalPanel({
      item: element
    });
    ReactDom.render(<CreateModule panel={panel}/>, element);
  }
  