From a224ed96ea41233dcb4770ff81631b7294390176 Mon Sep 17 00:00:00 2001 From: Matt Rothenberg Date: Tue, 19 Apr 2022 11:55:41 -0400 Subject: [PATCH] fix: pin explanation panel to right side of screen --- src/blocks/file-blocks/explain/index.tsx | 108 ++++++++++++----------- 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/src/blocks/file-blocks/explain/index.tsx b/src/blocks/file-blocks/explain/index.tsx index 43b5332..791a457 100644 --- a/src/blocks/file-blocks/explain/index.tsx +++ b/src/blocks/file-blocks/explain/index.tsx @@ -101,63 +101,65 @@ function BlockInner(props: FileBlockProps) { }, [content, context, start, end]); return ( -
- {start && end && ( -
- -
- )} - { - const isHighlighted = - start && end && lineNumber >= start && lineNumber <= end; - return { - "data-highlighted": isHighlighted, - onClick: (e: React.MouseEvent) => { - let clicked = e.target as HTMLElement; - if (!clicked.classList.contains("comment")) return; - handleLineClick(lineNumber, e.shiftKey); - }, - style: { - display: "block", - }, - }; - }} - showLineNumbers - > - {content} - - {Object.entries(explanations).map(([line, explanation]) => { - return ( +
+
+ {start && end && (
-
- ); - })} + )} + { + const isHighlighted = + start && end && lineNumber >= start && lineNumber <= end; + return { + "data-highlighted": isHighlighted, + onClick: (e: React.MouseEvent) => { + let clicked = e.target as HTMLElement; + if (!clicked.classList.contains("comment")) return; + handleLineClick(lineNumber, e.shiftKey); + }, + style: { + display: "block", + }, + }; + }} + showLineNumbers + > + {content} + + {Object.entries(explanations).map(([line, explanation]) => { + return ( +
+ +
+ ); + })} +
); }