Flesh out posting
This commit is contained in:
parent
567ec49794
commit
09b2b08421
1 changed files with 26 additions and 10 deletions
|
@ -7,11 +7,18 @@ import "react-mde/lib/styles/css/react-mde-all.css"
|
|||
const NewPost = (props) => {
|
||||
const [title, setTitle] = React.useState("");
|
||||
const [content, setContent] = React.useState("");
|
||||
const [tags, setTags] = React.useState("");
|
||||
const [selectedTab, setSelectedTab] = React.useState("write");
|
||||
|
||||
const submitPost = () => {
|
||||
console.log(title)
|
||||
console.log(content)
|
||||
const payload = {
|
||||
title: title,
|
||||
content: content,
|
||||
tags: tags,
|
||||
}
|
||||
console.log(payload)
|
||||
}
|
||||
|
||||
return(
|
||||
<div className="container">
|
||||
<input
|
||||
|
@ -20,15 +27,24 @@ const NewPost = (props) => {
|
|||
onChange={e => setTitle(e.target.value)}
|
||||
/>
|
||||
|
||||
<ReactMde
|
||||
value={content}
|
||||
onChange={setContent}
|
||||
selectedTab={selectedTab}
|
||||
onTabChange={setSelectedTab}
|
||||
generateMarkdownPreview={(markdown) =>
|
||||
Promise.resolve(<ReactMarkdown source={markdown} />)}
|
||||
<div className="markdown-body">
|
||||
<ReactMde
|
||||
value={content}
|
||||
onChange={setContent}
|
||||
selectedTab={selectedTab}
|
||||
onTabChange={setSelectedTab}
|
||||
generateMarkdownPreview={(markdown) =>
|
||||
Promise.resolve(<ReactMarkdown source={markdown} />)}
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
value={tags}
|
||||
placeholder="Comma,Seperated,Tags..."
|
||||
onChange={e => setTags(e.target.value)}
|
||||
/>
|
||||
<button onClick={submitPost}>Submit Post</button>
|
||||
<div>
|
||||
<button onClick={submitPost}>Submit Post</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Reference in a new issue