Skip to content

Commit

Permalink
Remove comment box from footer (facebook#2639)
Browse files Browse the repository at this point in the history
  • Loading branch information
thegreatercurve authored Jul 13, 2022
1 parent e70a5ad commit 1637d49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
8 changes: 0 additions & 8 deletions packages/lexical-playground/src/plugins/CommentPlugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,6 @@ i.comments {
overflow: hidden;
}

.CommentPlugin_CommentsPanel_Footer {
border-top: 1px solid #eee;
position: absolute;
bottom: 0;
left: 0;
width: 100%;
}

.CommentPlugin_CommentsPanel_Editor {
position: relative;
border: 1px solid #ccc;
Expand Down
43 changes: 0 additions & 43 deletions packages/lexical-playground/src/plugins/CommentPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,23 +406,6 @@ function CommentsComposer({
);
}

function CommentsPanelFooter({
footerRef,
submitAddComment,
}: {
footerRef: {current: null | HTMLDivElement};
submitAddComment: (
commentOrThread: Comment | Thread,
isInlineComment: boolean,
) => void;
}) {
return (
<div className="CommentPlugin_CommentsPanel_Footer" ref={footerRef}>
<CommentsComposer submitAddComment={submitAddComment} />
</div>
);
}

function ShowDeleteCommentOrThreadDialog({
commentOrThread,
deleteCommentOrThread,
Expand Down Expand Up @@ -682,31 +665,9 @@ function CommentsPanel({
thread?: Thread,
) => void;
}): JSX.Element {
const footerRef = useRef<HTMLDivElement>(null);
const listRef = useRef<HTMLUListElement>(null);
const isEmpty = comments.length === 0;

useLayoutEffect(() => {
const footerElem = footerRef.current;
if (footerElem !== null) {
const updateSize = () => {
const listElem = listRef.current;
if (listElem !== null) {
const rect = footerElem.getBoundingClientRect();
listElem.style.height = window.innerHeight - rect.height - 133 + 'px';
}
};
const resizeObserver = new ResizeObserver(updateSize);
resizeObserver.observe(footerElem);
window.addEventListener('resize', updateSize);

return () => {
window.removeEventListener('resize', updateSize);
resizeObserver.disconnect();
};
}
}, [isEmpty]);

return (
<div className="CommentPlugin_CommentsPanel">
<h2 className="CommentPlugin_CommentsPanel_Heading">Comments</h2>
Expand All @@ -722,10 +683,6 @@ function CommentsPanel({
markNodeMap={markNodeMap}
/>
)}
<CommentsPanelFooter
submitAddComment={submitAddComment}
footerRef={footerRef}
/>
</div>
);
}
Expand Down

0 comments on commit 1637d49

Please sign in to comment.