Toggle visibility of comment UI based on policy (#5143)

This commit is contained in:
Apoorv Mishra
2023-04-13 06:41:58 +05:30
committed by GitHub
parent 8bd797aed7
commit 511e790cb1
4 changed files with 19 additions and 6 deletions

View File

@@ -68,6 +68,8 @@ type Props = {
lastOfAuthor?: boolean;
/** The date of the previous comment in the thread */
previousCommentCreatedAt?: string;
/** Whether the user can reply in the thread */
canReply: boolean;
};
function CommentThreadItem({
@@ -77,6 +79,7 @@ function CommentThreadItem({
lastOfThread,
dir,
previousCommentCreatedAt,
canReply,
}: Props) {
const { editor } = useDocumentContext();
const { showToast } = useToasts();
@@ -139,6 +142,7 @@ function CommentThreadItem({
$firstOfAuthor={firstOfAuthor}
$lastOfThread={lastOfThread}
$dir={dir}
$canReply={canReply}
column
>
{(showAuthor || showTime) && (
@@ -247,6 +251,7 @@ export const Bubble = styled(Flex)<{
$firstOfThread?: boolean;
$firstOfAuthor?: boolean;
$lastOfThread?: boolean;
$canReply?: boolean;
$focused?: boolean;
$dir?: "rtl" | "ltr";
}>`
@@ -260,8 +265,9 @@ export const Bubble = styled(Flex)<{
padding: 8px 12px;
transition: color 100ms ease-out, ${s("backgroundTransition")};
${({ $lastOfThread }) =>
${({ $lastOfThread, $canReply }) =>
$lastOfThread &&
!$canReply &&
"border-bottom-left-radius: 8px; border-bottom-right-radius: 8px"};
${({ $firstOfThread }) =>