From 9910d61206eaa5e914ed7d995bb062316fb0412a Mon Sep 17 00:00:00 2001 From: TheRadly Date: Sat, 20 Jun 2020 08:03:33 +0300 Subject: [PATCH 1/5] [modules] Create AddCommentWidget for detail post --- Intl/localizationData/en.js | 2 ++ Intl/localizationData/fr.js | 2 ++ .../AddCommentWidget/AddCommentWidget.css | 9 ++++++++ .../AddCommentWidget/AddCommentWidget.jsx | 23 +++++++++++++++++++ client/modules/Post/components/PostList.js | 1 + .../pages/PostDetailPage/PostDetailPage.js | 9 ++++++-- 6 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 client/modules/Post/components/AddCommentWidget/AddCommentWidget.css create mode 100644 client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx diff --git a/Intl/localizationData/en.js b/Intl/localizationData/en.js index 79b481d3c..41944426f 100644 --- a/Intl/localizationData/en.js +++ b/Intl/localizationData/en.js @@ -3,12 +3,14 @@ export default { messages: { siteTitle: 'MERN Starter Blog', addPost: 'Add Post', + addComment: 'Add comment', switchLanguage: 'Switch Language', twitterMessage: 'We are on Twitter', by: 'By', deletePost: 'Delete Post', createNewPost: 'Create new post', authorName: 'Author\'s Name', + commentContent: 'Write your comment', postTitle: 'Post Title', postContent: 'Post Content', submit: 'Submit', diff --git a/Intl/localizationData/fr.js b/Intl/localizationData/fr.js index 7e5b81b3f..4fa5026bd 100644 --- a/Intl/localizationData/fr.js +++ b/Intl/localizationData/fr.js @@ -3,12 +3,14 @@ export default { messages: { siteTitle: 'MERN blog de démarrage', addPost: 'Ajouter Poster', + addComment: 'Ajouter un commentaire', switchLanguage: 'Changer de langue', twitterMessage: 'Nous sommes sur Twitter', by: 'Par', deletePost: 'Supprimer le message', createNewPost: 'Créer un nouveau message', authorName: 'Nom de l\'auteur', + commentContent: 'Écrivez votre commentaire', postTitle: 'Titre de l\'article', postContent: 'Contenu après', submit: 'Soumettre', diff --git a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css new file mode 100644 index 000000000..25727ee97 --- /dev/null +++ b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css @@ -0,0 +1,9 @@ +.comment-submit-button { + display: inline-block; + padding: 8px 16px; + font-size: 18px; + color: #FFF; + background: #03A9F4; + text-decoration: none; + border-radius: 4px; +} \ No newline at end of file diff --git a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx new file mode 100644 index 000000000..f73827ac4 --- /dev/null +++ b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; + +// Import Style +import styles from './AddCommentWidget.css'; + +const AddCommentWidget = (props) => { + return ( +
+

+ + + +
+ ); +}; + +AddCommentWidget.propTypes = { + intl: intlShape.isRequired, +}; + +export default injectIntl(AddCommentWidget); diff --git a/client/modules/Post/components/PostList.js b/client/modules/Post/components/PostList.js index 6719b3124..2f073e449 100644 --- a/client/modules/Post/components/PostList.js +++ b/client/modules/Post/components/PostList.js @@ -5,6 +5,7 @@ import PropTypes from 'prop-types'; import PostListItem from './PostListItem/PostListItem'; function PostList(props) { + console.log(props); return (
{ diff --git a/client/modules/Post/pages/PostDetailPage/PostDetailPage.js b/client/modules/Post/pages/PostDetailPage/PostDetailPage.js index 32c1e1c11..8de4a18cf 100644 --- a/client/modules/Post/pages/PostDetailPage/PostDetailPage.js +++ b/client/modules/Post/pages/PostDetailPage/PostDetailPage.js @@ -2,7 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import Helmet from 'react-helmet'; -import { FormattedMessage } from 'react-intl'; +import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; +import AddCommentWidget from '../../components/AddCommentWidget/AddCommentWidget'; + // Import Style import styles from '../../components/PostListItem/PostListItem.css'; @@ -21,6 +23,7 @@ export function PostDetailPage(props) {

{props.post.title}

{props.post.name}

{props.post.content}

+
); @@ -45,7 +48,9 @@ PostDetailPage.propTypes = { content: PropTypes.string.isRequired, slug: PropTypes.string.isRequired, cuid: PropTypes.string.isRequired, + intl: intlShape.isRequired, }).isRequired, }; -export default connect(mapStateToProps)(PostDetailPage); +const postDetailWithInjectionIntl = injectIntl(PostDetailPage); +export default connect(mapStateToProps)(postDetailWithInjectionIntl); From 33e53b2dc1faa74b03dcd93dc0976eed04376a9b Mon Sep 17 00:00:00 2001 From: TheRadly Date: Sat, 20 Jun 2020 08:14:20 +0300 Subject: [PATCH 2/5] Create styles for add post widget --- .../AddCommentWidget/AddCommentWidget.css | 21 +++++++++++++++++++ .../AddCommentWidget/AddCommentWidget.jsx | 8 +++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css index 25727ee97..ec7063eab 100644 --- a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css +++ b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.css @@ -1,3 +1,6 @@ +.comment-form { + margin-top: 5rem; +} .comment-submit-button { display: inline-block; padding: 8px 16px; @@ -6,4 +9,22 @@ background: #03A9F4; text-decoration: none; border-radius: 4px; +} +.comment-form-title { + font-size: 16px; + font-weight: 700; + margin-bottom: 16px; + color: #757575; +} +.comment-form-field { + width: 100%; + margin-bottom: 16px; + font-family: 'Lato', sans-serif; + font-size: 16px; + line-height: normal; + padding: 12px 16px; + border-radius: 4px; + border: 1px solid #ddd; + outline: none; + color: #212121; } \ No newline at end of file diff --git a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx index f73827ac4..b977f1301 100644 --- a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx +++ b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx @@ -7,10 +7,10 @@ import styles from './AddCommentWidget.css'; const AddCommentWidget = (props) => { return ( -
-

- - +
+

+ +
); From a933d39390da2ed7b522b11cab7e3e66ae483fe9 Mon Sep 17 00:00:00 2001 From: TheRadly Date: Sat, 20 Jun 2020 09:20:17 +0300 Subject: [PATCH 3/5] Added list comments & design elements --- .../AddCommentWidget/AddCommentWidget.jsx | 7 +++- .../modules/Post/components/CommentList.jsx | 39 +++++++++++++++++++ .../CommentListItem/CommentListItem.css | 39 +++++++++++++++++++ .../CommentListItem/CommentListItem.jsx | 33 ++++++++++++++++ client/modules/Post/components/PostList.js | 1 - .../pages/PostDetailPage/PostDetailPage.js | 3 +- 6 files changed, 119 insertions(+), 3 deletions(-) create mode 100644 client/modules/Post/components/CommentList.jsx create mode 100644 client/modules/Post/components/CommentListItem/CommentListItem.css create mode 100644 client/modules/Post/components/CommentListItem/CommentListItem.jsx diff --git a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx index b977f1301..b45658583 100644 --- a/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx +++ b/client/modules/Post/components/AddCommentWidget/AddCommentWidget.jsx @@ -5,10 +5,15 @@ import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; // Import Style import styles from './AddCommentWidget.css'; +// Import components +import CommentList from '../CommentList'; + const AddCommentWidget = (props) => { return (
-

+ + +

diff --git a/client/modules/Post/components/CommentList.jsx b/client/modules/Post/components/CommentList.jsx new file mode 100644 index 000000000..0db509e4b --- /dev/null +++ b/client/modules/Post/components/CommentList.jsx @@ -0,0 +1,39 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +// Import Components +import CommentListItem from './CommentListItem/CommentListItem'; + +const CommentList = () => { + const comment = { + author: 'Alex', + content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet.', + }; + return ( +
+ { + // props.posts.map(post => ( + // props.handleDeletePost(post.cuid)} + // /> + // )) + + } +
+ ); +}; + +CommentList.propTypes = { + posts: PropTypes.arrayOf(PropTypes.shape({ + name: PropTypes.string.isRequired, + title: PropTypes.string.isRequired, + content: PropTypes.string.isRequired, + slug: PropTypes.string.isRequired, + cuid: PropTypes.string.isRequired, + })).isRequired, + handleDeletePost: PropTypes.func.isRequired, +}; + +export default CommentList; diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.css b/client/modules/Post/components/CommentListItem/CommentListItem.css new file mode 100644 index 000000000..b98717ddf --- /dev/null +++ b/client/modules/Post/components/CommentListItem/CommentListItem.css @@ -0,0 +1,39 @@ +.comment-item-container { + margin: 1rem 0 1rem 0; + background-color: whitesmoke; + padding: 1rem; + border-radius: 10px; + position: relative; +} +.author-name { + margin: 0.5rem 0 0 0.5rem; + font-family: 'Lato', sans-serif; +} +.comment-content { + margin: 0 0 0 0.5rem; + font-family: 'Lato', sans-serif; + font-size: 14px; + color: #424242; +} +.comment-delete-button { + position: absolute; + right: 0; + margin: 0.2rem 1rem 0 0; + top: 0; + font-size: 26px; + cursor: pointer; +} +.comment-delete-button:hover { + color: red; +} +.comment-edit-button { + position: absolute; + right: 0; + top: 0; + margin: 0.5rem 2.5rem 0 0; + font-size: 18px; + cursor: pointer; +} +.comment-edit-button:hover { + color: green; +} \ No newline at end of file diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.jsx b/client/modules/Post/components/CommentListItem/CommentListItem.jsx new file mode 100644 index 000000000..a653e3c18 --- /dev/null +++ b/client/modules/Post/components/CommentListItem/CommentListItem.jsx @@ -0,0 +1,33 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedMessage } from 'react-intl'; + +// Import Style +import styles from './CommentListItem.css'; + +const CommentListItem = (props) => { + return ( +
+

Comment #1

+

+ +   + {props.comment.author} +

+

{props.comment.content}

+

×

+

+
+ ); +}; + +CommentListItem.propTypes = { + comment: PropTypes.shape({ + author: PropTypes.string.isRequired, + content: PropTypes.string.isRequired, + cuid: PropTypes.string.isRequired, + }).isRequired, + // onDelete: PropTypes.func.isRequired, +}; + +export default CommentListItem; diff --git a/client/modules/Post/components/PostList.js b/client/modules/Post/components/PostList.js index 2f073e449..6719b3124 100644 --- a/client/modules/Post/components/PostList.js +++ b/client/modules/Post/components/PostList.js @@ -5,7 +5,6 @@ import PropTypes from 'prop-types'; import PostListItem from './PostListItem/PostListItem'; function PostList(props) { - console.log(props); return (
{ diff --git a/client/modules/Post/pages/PostDetailPage/PostDetailPage.js b/client/modules/Post/pages/PostDetailPage/PostDetailPage.js index 8de4a18cf..4bdb0d3f9 100644 --- a/client/modules/Post/pages/PostDetailPage/PostDetailPage.js +++ b/client/modules/Post/pages/PostDetailPage/PostDetailPage.js @@ -3,8 +3,9 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import Helmet from 'react-helmet'; import { injectIntl, intlShape, FormattedMessage } from 'react-intl'; -import AddCommentWidget from '../../components/AddCommentWidget/AddCommentWidget'; +// Import Components +import AddCommentWidget from '../../components/AddCommentWidget/AddCommentWidget'; // Import Style import styles from '../../components/PostListItem/PostListItem.css'; From 85ff283466e3c00e2bd093d1febd3a1cd5ca1b4c Mon Sep 17 00:00:00 2001 From: TheRadly Date: Sat, 20 Jun 2020 11:23:04 +0300 Subject: [PATCH 4/5] Added comment editor & change package react versions --- .../modules/Post/components/CommentList.jsx | 22 ++++++------ .../CommentListItem/CommentListItem.css | 28 +++++++++++++++ .../CommentListItem/CommentListItem.jsx | 35 +++++++++++++------ .../pages/PostDetailPage/PostDetailPage.js | 6 ++-- package.json | 8 ++--- 5 files changed, 69 insertions(+), 30 deletions(-) diff --git a/client/modules/Post/components/CommentList.jsx b/client/modules/Post/components/CommentList.jsx index 0db509e4b..4dc427c90 100644 --- a/client/modules/Post/components/CommentList.jsx +++ b/client/modules/Post/components/CommentList.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import PropTypes from 'prop-types'; +//import PropTypes from 'prop-types'; // Import Components import CommentListItem from './CommentListItem/CommentListItem'; @@ -25,15 +25,15 @@ const CommentList = () => { ); }; -CommentList.propTypes = { - posts: PropTypes.arrayOf(PropTypes.shape({ - name: PropTypes.string.isRequired, - title: PropTypes.string.isRequired, - content: PropTypes.string.isRequired, - slug: PropTypes.string.isRequired, - cuid: PropTypes.string.isRequired, - })).isRequired, - handleDeletePost: PropTypes.func.isRequired, -}; +// CommentList.propTypes = { +// posts: PropTypes.arrayOf(PropTypes.shape({ +// name: PropTypes.string.isRequired, +// title: PropTypes.string.isRequired, +// content: PropTypes.string.isRequired, +// slug: PropTypes.string.isRequired, +// cuid: PropTypes.string.isRequired, +// })).isRequired, +// handleDeletePost: PropTypes.func.isRequired, +// }; export default CommentList; diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.css b/client/modules/Post/components/CommentListItem/CommentListItem.css index b98717ddf..0e9903893 100644 --- a/client/modules/Post/components/CommentListItem/CommentListItem.css +++ b/client/modules/Post/components/CommentListItem/CommentListItem.css @@ -5,6 +5,7 @@ border-radius: 10px; position: relative; } + .author-name { margin: 0.5rem 0 0 0.5rem; font-family: 'Lato', sans-serif; @@ -36,4 +37,31 @@ } .comment-edit-button:hover { color: green; +} +.edit-form-field { + width: 100%; + margin-bottom: 5px; + margin-top: 16px; + font-family: 'Lato', sans-serif; + font-size: 16px; + line-height: normal; + padding: 12px 16px; + border-radius: 4px; + border: 1px solid #ddd; + outline: none; + color: #212121; +} +.edit-button { + margin: 0.2rem 1rem 0 0; + font-size: 14px; + border-radius: 5px; + cursor: pointer; + padding: 7px; + outline: none !important; + border: none; + background-color: rgb(209, 209, 209); + width: 70px; +} +.edit-button:hover { + background-color: white; } \ No newline at end of file diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.jsx b/client/modules/Post/components/CommentListItem/CommentListItem.jsx index a653e3c18..d7e864f51 100644 --- a/client/modules/Post/components/CommentListItem/CommentListItem.jsx +++ b/client/modules/Post/components/CommentListItem/CommentListItem.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; @@ -6,17 +6,31 @@ import { FormattedMessage } from 'react-intl'; import styles from './CommentListItem.css'; const CommentListItem = (props) => { + const [edit, setEdit] = useState(false); + return (
-

Comment #1

-

- -   - {props.comment.author} -

-

{props.comment.content}

-

×

-

+ { + !edit ? +
+

Comment #1

+

+ +   + {props.comment.author} +

+

{props.comment.content}

+

×

+

setEdit(true)} className={styles['comment-edit-button']}>✎

+
: +
+

Comment #1

+ + +

addNewComment()} className={styles['comment-submit-button']} href="#">

+
+ ); +}; + +AddCommentWidget.propTypes = { + intl: intlShape.isRequired, + comments: PropTypes.object.isRequired, + addComment: PropTypes.func.isRequired, +}; + +const mapStateToProps = (state) => { + return { + comments: getComments(state), + }; +}; + +export default injectIntl(connect(mapStateToProps, { addComment })(AddCommentWidget)); diff --git a/client/modules/Comment/CommentActions.js b/client/modules/Comment/CommentActions.js new file mode 100644 index 000000000..21b62c31a --- /dev/null +++ b/client/modules/Comment/CommentActions.js @@ -0,0 +1,29 @@ +// Export Constants +export const ADD_COMMENT = 'ADD_COMMENT'; +export const EDIT_COMMENT = 'EDIT_COMMENT'; +export const DELETE_COMMENT = 'DELETE_COMMENT'; + +// Export Actions +export const addComment = (author, content) => { + return { + type: ADD_COMMENT, + author, + content, + }; +}; + +export const editComment = (author, content, cid) => { + return { + type: EDIT_COMMENT, + author, + content, + cid, + }; +}; + +export const deleteComment = (cid) => { + return { + type: DELETE_COMMENT, + cid, + }; +}; diff --git a/client/modules/Comment/CommentList.jsx b/client/modules/Comment/CommentList.jsx new file mode 100644 index 000000000..ff8697e7c --- /dev/null +++ b/client/modules/Comment/CommentList.jsx @@ -0,0 +1,30 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +// Import Components +import CommentListItem from './CommentListItem/CommentListItem'; + +const CommentList = (props) => { + return ( +
+ { + props.comments.map(comment => ( + + )) + } +
+ ); +}; +//onDelete={() => props.handleDeletePost(post.cuid)} +CommentList.propTypes = { + comments: PropTypes.arrayOf(PropTypes.shape({ + cid: PropTypes.number.isRequired, + author: PropTypes.string.isRequired, + content: PropTypes.string.isRequired, + })).isRequired, +}; + +export default CommentList; diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.css b/client/modules/Comment/CommentListItem/CommentListItem.css similarity index 98% rename from client/modules/Post/components/CommentListItem/CommentListItem.css rename to client/modules/Comment/CommentListItem/CommentListItem.css index 0e9903893..3f425d231 100644 --- a/client/modules/Post/components/CommentListItem/CommentListItem.css +++ b/client/modules/Comment/CommentListItem/CommentListItem.css @@ -7,6 +7,7 @@ } .author-name { + display: flex; margin: 0.5rem 0 0 0.5rem; font-family: 'Lato', sans-serif; } diff --git a/client/modules/Comment/CommentListItem/CommentListItem.jsx b/client/modules/Comment/CommentListItem/CommentListItem.jsx new file mode 100644 index 000000000..8d1844919 --- /dev/null +++ b/client/modules/Comment/CommentListItem/CommentListItem.jsx @@ -0,0 +1,82 @@ +import React, { useState, useRef } from 'react'; +import PropTypes from 'prop-types'; +import { intlShape, injectIntl, FormattedMessage } from 'react-intl'; +import { connect } from 'react-redux'; + + +// Import Style +import styles from './CommentListItem.css'; + +// Import selectors +import { getComment } from '../CommentReducer'; + +// Import actions +import { editComment, deleteComment } from '../CommentActions'; + +const CommentListItem = (props) => { + const [edit, setEdit] = useState(false); + + const editAuthorRef = useRef(); + const editContentRef = useRef(); + + const onClickSaveButton = () => { + editAuthorRef.current.focus(); + editContentRef.current.focus(); + + if (editAuthorRef.current.value && editContentRef.current.value) { + props.editComment(editAuthorRef.current.value, editContentRef.current.value, props.comment.cid); + setEdit(false); + } + }; + + const onClickOnDeleteButton = () => { + if (confirm(props.intl.messages.confirmDeleteComment)) { // eslint-disable-line + props.deleteComment(props.comment.cid); + } + }; + + return ( +
+ { + !edit ? +
+

#{props.comment.cid}

+

+ +   +

{props.comment.author}

+

+

{props.comment.content}

+

onClickOnDeleteButton()}className={styles['comment-delete-button']}>×

+

setEdit(true)} className={styles['comment-edit-button']}>✎

+
: +
+

#{props.comment.cid}

+ + - -
- ); -}; - -AddCommentWidget.propTypes = { - intl: intlShape.isRequired, -}; - -export default injectIntl(AddCommentWidget); diff --git a/client/modules/Post/components/CommentList.jsx b/client/modules/Post/components/CommentList.jsx deleted file mode 100644 index 4dc427c90..000000000 --- a/client/modules/Post/components/CommentList.jsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react'; -//import PropTypes from 'prop-types'; - -// Import Components -import CommentListItem from './CommentListItem/CommentListItem'; - -const CommentList = () => { - const comment = { - author: 'Alex', - content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet.', - }; - return ( -
- { - // props.posts.map(post => ( - // props.handleDeletePost(post.cuid)} - // /> - // )) - - } -
- ); -}; - -// CommentList.propTypes = { -// posts: PropTypes.arrayOf(PropTypes.shape({ -// name: PropTypes.string.isRequired, -// title: PropTypes.string.isRequired, -// content: PropTypes.string.isRequired, -// slug: PropTypes.string.isRequired, -// cuid: PropTypes.string.isRequired, -// })).isRequired, -// handleDeletePost: PropTypes.func.isRequired, -// }; - -export default CommentList; diff --git a/client/modules/Post/components/CommentListItem/CommentListItem.jsx b/client/modules/Post/components/CommentListItem/CommentListItem.jsx deleted file mode 100644 index d7e864f51..000000000 --- a/client/modules/Post/components/CommentListItem/CommentListItem.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, { useState } from 'react'; -import PropTypes from 'prop-types'; -import { FormattedMessage } from 'react-intl'; - -// Import Style -import styles from './CommentListItem.css'; - -const CommentListItem = (props) => { - const [edit, setEdit] = useState(false); - - return ( -
- { - !edit ? -
-

Comment #1

-

- -   - {props.comment.author} -

-

{props.comment.content}

-

×

-

setEdit(true)} className={styles['comment-edit-button']}>✎

-
: -
-

Comment #1

- -