-
+ this.props.searchPostFn(e.target.value)}placeholder="Search Your Feed" />
diff --git a/src/components/Post/Edit/Edit.js b/src/components/Post/Edit/Edit.js
index 29e4d05..058223a 100644
--- a/src/components/Post/Edit/Edit.js
+++ b/src/components/Post/Edit/Edit.js
@@ -19,7 +19,19 @@ export default class Edit extends Component {
this.setState({ text: value });
}
- updatePost() {}
+ updatePost() {
+ const date = new Date().toLocaleString('en-PH', {
+ day: 'numeric',
+ month: 'short',
+ year: 'numeric',
+ });
+
+ const { text } = this.state;
+ const { id, updatePostFn, hideEdit } = this.props;
+ updatePostFn(id,text, date);
+ hideEdit();
+
+ }
render() {
// More destructuring!
diff --git a/src/components/Post/Post.js b/src/components/Post/Post.js
index c7cb520..6ea170f 100644
--- a/src/components/Post/Post.js
+++ b/src/components/Post/Post.js
@@ -55,7 +55,7 @@ export default class Post extends Component {
// This is destructuring! You can also think of it as being written as so:
// const editing = this.state.editing
// const showMasterMenu = this.state.showMasterMenu
- const { editing, showMasterMenu } = this.state;
+ const { editing, showMasterMenu, id } = this.state;
return (
// Main body of post
@@ -70,7 +70,7 @@ export default class Post extends Component {
style={{ display: showMasterMenu ? 'flex' : 'none' }}
>
Edit
- Delete
+ this.props.deletePostFn(this.props.id)}>Delete
@@ -83,7 +83,7 @@ export default class Post extends Component {
DevMountain@DevMountain
- - POST DATE GOES HERE
+ {this.props.date}
{/* This is where the text goes. Notice the turnary statement. The turnary statement decides to display either the text OR the editor view
@@ -97,9 +97,14 @@ export default class Post extends Component {
{// This has been pulled off of this.state via destructuring
editing ? (
-
+ console.log(this.props.id),
+
) : (
- POST TEXT GOES HERE
+ {this.props.text}
)}