|
1 |
| -import React from 'react' |
| 1 | +import React, { Component } from 'react' |
2 | 2 | import PropTypes from 'prop-types'
|
3 | 3 | import {connect} from 'react-redux'
|
4 | 4 | import {withRouter, Link} from 'react-router-dom'
|
| 5 | +import { Editor, EditorState} from 'draft-js'; |
5 | 6 | import {logout} from '../store'
|
| 7 | +import AceEditor from 'react-ace' |
| 8 | +import brace from 'brace'; |
| 9 | +import 'brace/mode/javascript'; |
| 10 | +import 'brace/theme/monokai'; |
6 | 11 |
|
7 |
| -/** |
8 |
| - * COMPONENT |
9 |
| - * The Main component is our 'picture frame' - it displays the navbar and anything |
10 |
| - * else common to our entire app. The 'picture' inside the frame is the space |
11 |
| - * rendered out by the component's `children`. |
12 |
| - */ |
13 |
| -const Main = (props) => { |
14 |
| - const {children, handleClick, isLoggedIn} = props |
| 12 | +class Main extends Component { |
| 13 | + constructor(props) { |
| 14 | + super(props); |
| 15 | + this.onChange = this.onChange.bind(this) |
| 16 | + } |
| 17 | + |
| 18 | + onChange = (obj) => { |
| 19 | + console.log(obj) |
| 20 | + } |
| 21 | + |
| 22 | + render () { |
| 23 | + return ( |
| 24 | + <AceEditor |
| 25 | + mode="javascript" |
| 26 | + theme="monokai" |
| 27 | + height="50em" |
| 28 | + onChange={this.onChange} |
| 29 | + /> |
| 30 | + ) |
| 31 | + } |
15 | 32 |
|
16 |
| - return ( |
17 |
| - <div> |
18 |
| - <h1>BOILERMAKER</h1> |
19 |
| - <nav> |
20 |
| - { |
21 |
| - isLoggedIn |
22 |
| - ? <div> |
23 |
| - {/* The navbar will show these links after you log in */} |
24 |
| - <Link to="/home">Home</Link> |
25 |
| - <a href="#" onClick={handleClick}>Logout</a> |
26 |
| - </div> |
27 |
| - : <div> |
28 |
| - {/* The navbar will show these links before you log in */} |
29 |
| - <Link to="/login">Login</Link> |
30 |
| - <Link to="/signup">Sign Up</Link> |
31 |
| - </div> |
32 |
| - } |
33 |
| - </nav> |
34 |
| - <hr /> |
35 |
| - {children} |
36 |
| - </div> |
37 |
| - ) |
| 33 | + // <div> |
| 34 | + // <h1>BOILERMAKER</h1> |
| 35 | + // <nav> |
| 36 | + // { |
| 37 | + // isLoggedIn |
| 38 | + // ? <div> |
| 39 | + // {/* The navbar will show these links after you log in */} |
| 40 | + // <Link to="/home">Home</Link> |
| 41 | + // <a href="#" onClick={handleClick}>Logout</a> |
| 42 | + // </div> |
| 43 | + // : <div> |
| 44 | + // {/* The navbar will show these links before you log in */} |
| 45 | + // <Link to="/login">Login</Link> |
| 46 | + // <Link to="/signup">Sign Up</Link> |
| 47 | + // </div> |
| 48 | + // } |
| 49 | + // </nav> |
| 50 | + // <hr /> |
| 51 | + // {children} |
| 52 | + // </div> |
38 | 53 | }
|
39 | 54 |
|
40 | 55 | /**
|
|
0 commit comments