From 19929c97d82248a01676e261292e426019a3ad29 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 18 Jul 2017 20:17:01 +0700 Subject: [PATCH] Fix layout issues in comment --- .../src/components/Comment.css | 33 +- .../src/components/Comment.js | 292 +++++++++--------- .../src/components/Toggleable.css | 14 +- .../src/components/Toggleable.js | 5 +- 4 files changed, 172 insertions(+), 172 deletions(-) diff --git a/client/coral-embed-stream/src/components/Comment.css b/client/coral-embed-stream/src/components/Comment.css index 2b7198a1d..7eb2ece71 100644 --- a/client/coral-embed-stream/src/components/Comment.css +++ b/client/coral-embed-stream/src/components/Comment.css @@ -17,8 +17,6 @@ .comment { padding-left: 15px; - display: flex; - flex-flow: row; } .commentLevel0 { @@ -67,17 +65,6 @@ border-bottom: 1px solid rgba(255, 255, 255, 0.3); } -/* element in the top right of the Comment */ -.topRight { - float: right; - margin-top: 10px; - text-align: right; -} - -.topRight > * { - text-align: initial; -} - .topRight .popover { margin-top: 1em; right: 0px; @@ -89,11 +76,6 @@ border-bottom: 2px solid currentColor; } -.topRightMenu { - cursor: pointer; - margin-top: 5px; -} - .editCommentForm { margin-bottom: 10px; } @@ -144,7 +126,7 @@ } .commentInfoBar { - float: right; + margin-left: auto; } @keyframes enter { @@ -158,7 +140,6 @@ } .commentContainer { - flex: auto; } .commentAvatar { @@ -177,3 +158,15 @@ .commentFooter { padding-top: 8px; } + +.header { + display: flex; + align-items: center; +} + +.content { +} + +.footer { + +} diff --git a/client/coral-embed-stream/src/components/Comment.js b/client/coral-embed-stream/src/components/Comment.js index 792dfd2d5..8e0539279 100644 --- a/client/coral-embed-stream/src/components/Comment.js +++ b/client/coral-embed-stream/src/components/Comment.js @@ -403,165 +403,169 @@ export default class Comment extends React.Component {
- - {isStaff(comment.tags) ? Staff : null} +
+ + {isStaff(comment.tags) ? Staff : null} - - - { - (comment.editing && comment.editing.edited) - ?  ({t('comment.edited')}) - : null - } - - - - - { (currentUser && (comment.user.id === currentUser.id)) && - - /* User can edit/delete their own comment for a short window after posting */ - + + { - commentIsStillEditable(comment) && - Edit + (comment.editing && comment.editing.edited) + ?  ({t('comment.edited')}) + : null } - } - { (currentUser && (comment.user.id !== currentUser.id)) && - /* TopRightMenu allows currentUser to ignore other users' comments */ - - + + + { (currentUser && (comment.user.id === currentUser.id)) && + + /* User can edit/delete their own comment for a short window after posting */ + + { + commentIsStillEditable(comment) && + Edit + } - } - { - this.state.isEditing - ? - :
- -
- } + } + { (currentUser && (comment.user.id !== currentUser.id)) && -
- - {!disableReply && - - - } + /* TopRightMenu allows currentUser to ignore other users' comments */ + + + + }
-
- - - + { + this.state.isEditing + ? + :
+ +
+ } +
+
+
+ - + {!disableReply && + + + } +
+
+ + + + +
- {activeReplyBox === comment.id - ? { - setActiveReplyBox(''); - }} + {activeReplyBox === comment.id + ? { + setActiveReplyBox(''); + }} + charCountEnable={charCountEnable} + maxCharCount={maxCharCount} + setActiveReplyBox={setActiveReplyBox} + parentId={(depth < THREADING_LEVEL) ? comment.id : parentId} + addNotification={addNotification} + postComment={postComment} + currentUser={currentUser} + assetId={asset.id} + /> + : null} + + + {view.map((reply) => { + return commentIsIgnored(reply) + ? + : - : null} - - - {view.map((reply) => { - return commentIsIgnored(reply) - ? - : ; - })} - -
- + showSignInDialog={showSignInDialog} + commentIsIgnored={commentIsIgnored} + liveUpdates={liveUpdates} + reactKey={reply.id} + key={reply.id} + comment={reply} + />; + })} + +
+
); diff --git a/client/coral-embed-stream/src/components/Toggleable.css b/client/coral-embed-stream/src/components/Toggleable.css index 0ce8a119b..bbdd5e3d6 100644 --- a/client/coral-embed-stream/src/components/Toggleable.css +++ b/client/coral-embed-stream/src/components/Toggleable.css @@ -2,21 +2,25 @@ outline: none; } -/** +.toggler { + composes: buttonReset from "coral-framework/styles/reset.css"; +} + +/** * Up/Down Chevrons for the top right menu */ .chevron { } .chevron:before { content: '⌃'; - display: inline-block; + display: inline-block; position: relative; - top: 0.25em; + top: 0.25em; } -/* Down Arrow */ +/* Down Arrow */ .chevron.down:before { - display: inline-block; + display: inline-block; position: relative; transform: rotate(180deg); top: 0; diff --git a/client/coral-embed-stream/src/components/Toggleable.js b/client/coral-embed-stream/src/components/Toggleable.js index c7996d866..1c70f2468 100644 --- a/client/coral-embed-stream/src/components/Toggleable.js +++ b/client/coral-embed-stream/src/components/Toggleable.js @@ -27,9 +27,8 @@ export default class Toggleable extends React.Component { const {isOpen} = this.state; return ( - - {isOpen ? upArrow : downArrow} + + {isOpen ? children : null}