From 5e5c161ca7e27892caef8ad508a9b2abca9d0193 Mon Sep 17 00:00:00 2001 From: Glen Wider Date: Tue, 27 Apr 2021 16:30:44 +0200 Subject: [PATCH] add showComments prop to CodeReview --- src/components/CodeLine.tsx | 22 ++++++++++++++-------- src/components/CodeReview.tsx | 7 +++++-- src/components/CodeReviewCard.tsx | 5 ++++- src/stories/CodeReviewCard.stories.tsx | 3 +++ 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/components/CodeLine.tsx b/src/components/CodeLine.tsx index 13b4298..8c223ae 100644 --- a/src/components/CodeLine.tsx +++ b/src/components/CodeLine.tsx @@ -58,6 +58,7 @@ export interface CodeLineProps { commentThread: boolean, comments: CustomComment[] onReplyCreated: (value: string) => void + showComments: boolean } export const CodeLine: React.FC = ({line, @@ -69,7 +70,8 @@ export const CodeLine: React.FC = ({line, severeInfo, commentThread, comments, - onReplyCreated + onReplyCreated, + showComments }) => { // isShown manages visibility of addButton @@ -82,6 +84,9 @@ export const CodeLine: React.FC = ({line, // returns the right padding value depending on the number of annotations present const getPaddingLeft = () => { + if(!showComments) { + return 4.3 + } if((commentThread && !(mildInfo || severeInfo)) || (mildInfo && !(commentThread ||severeInfo)) || (severeInfo && !(commentThread || mildInfo))) { @@ -134,7 +139,8 @@ export const CodeLine: React.FC = ({line, data-testid={"line" + lineNo} >
- {isShown && ( + + {(isShown && showComments) && ( <>