text: import React, {Component} from 'react';
  import PropTypes from 'prop-types';
  import { withStyles } from 'material-ui/styles';
  import List, { ListItem, ListItemText } from 'material-ui/List';
  import Avatar from 'material-ui/Avatar';
  import ReceiptIcon from 'material-ui-icons/Receipt';
  
  const styles = theme => ({
      root: {
          width: '100%',
          maxWidth: 360,
          background: theme.palette.background.paper,
      },
  });
  
  const LAMBDA_URL = 'https://frzkt0170f.execute-api.eu-central-1.amazonaws.com/dev/projects';
  
  class ProjectList extends Component {
  
      constructor(props) {
          super(props);
  
          this.state = {
              projects: []
          }
      }
  
      componentDidMount = () => {
          return fetch(LAMBDA_URL, {
              method: 'GET',
              mode: 'cors'
          })
              .then((response) => response.json())
              .then((data) => this.setState({
                  projects: data.items
              }));
      };
  
      render() {
          const { classes } = this.props;
          let { projects } = this.state;
          return (
              <div className={classes.root}>
                  <List>
                      {projects.map((project) =>
                          <ListItem button key={project.projectCode}>
                              <Avatar>
                                  <ReceiptIcon />
                              </Avatar>
                              <ListItemText primary={project.projectCode} secondary={`${project.cst} - ${project.name}`} />
                          </ListItem>
                      )}
                  </List>
              </div>
          );
      }
  }
  
  ProjectList.propTypes = {
      classes: PropTypes.object.isRequired,
  };
  
  export default withStyles(styles)(ProjectList);