test out react-mde
This commit is contained in:
parent
c99e40c5d7
commit
5a057337cd
3 changed files with 39 additions and 1 deletions
|
@ -6,6 +6,7 @@ import PostList from './PostList';
|
||||||
import Post from './Post';
|
import Post from './Post';
|
||||||
import User from './User';
|
import User from './User';
|
||||||
import About from './About'
|
import About from './About'
|
||||||
|
import NewPost from './NewPost'
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
@ -18,6 +19,7 @@ function App() {
|
||||||
<Route exact path="/posts/" component={PostList}/>
|
<Route exact path="/posts/" component={PostList}/>
|
||||||
<Route path="/posts/:slug" component={Post}/>
|
<Route path="/posts/:slug" component={Post}/>
|
||||||
<Route path="/users/:user" component={User}/>
|
<Route path="/users/:user" component={User}/>
|
||||||
|
<Route path="/newpost/" component={NewPost}/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
<Footer/>
|
<Footer/>
|
||||||
|
|
|
@ -190,7 +190,7 @@ class AuthMenu extends Component {
|
||||||
<div className="ui menu dropdown" style={{display: "inline"}}>
|
<div className="ui menu dropdown" style={{display: "inline"}}>
|
||||||
<div className="ui left icon input">
|
<div className="ui left icon input">
|
||||||
<i className="edit icon"></i>
|
<i className="edit icon"></i>
|
||||||
<button onClick={this.handleMakePost} className="fluid ui positive button">Create Post!</button>
|
<button onClick={() => { document.location.href = "newpost"; }} className="fluid ui positive button">Create Post!</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
36
src/components/NewPost.js
Normal file
36
src/components/NewPost.js
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import React from 'react';
|
||||||
|
import ReactMde from "react-mde";
|
||||||
|
import ReactMarkdown from 'react-markdown';
|
||||||
|
import 'github-markdown-css'
|
||||||
|
|
||||||
|
class NewPost extends React.Component {
|
||||||
|
constructor (props) {
|
||||||
|
super(props)
|
||||||
|
this.state = {
|
||||||
|
title: '',
|
||||||
|
content: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
handleChange = value => {
|
||||||
|
this.setState({ mdeValue: value });
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
render () {
|
||||||
|
return(
|
||||||
|
<div className="container">
|
||||||
|
<ReactMde
|
||||||
|
value={this.state.content}
|
||||||
|
/*
|
||||||
|
onChange={setValue}
|
||||||
|
selectedTab={selectedTab}
|
||||||
|
onTabChange={setSelectedTab}
|
||||||
|
*/
|
||||||
|
generateMarkdownPreview={(markdown) => <ReactMarkdown source={markdown} />}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default NewPost;
|
Reference in a new issue