({entry}: SourceFrameProps)
| 11 | } |
| 12 | |
| 13 | export function SourceCodeFrame({entry}: SourceFrameProps) { |
| 14 | const frame = useMemo( |
| 15 | () => (entry ? getSourceCodeFrame(entry) : null), |
| 16 | [entry], |
| 17 | ); |
| 18 | |
| 19 | return ( |
| 20 | <div className={styles.sourceCode}> |
| 21 | <pre> |
| 22 | <code |
| 23 | className="language-ts" |
| 24 | dangerouslySetInnerHTML={{ |
| 25 | __html: frame ?? 'Could not load the source code.', |
| 26 | }} |
| 27 | /> |
| 28 | </pre> |
| 29 | <IconButton |
| 30 | title="Go to source" |
| 31 | className={styles.viewSource} |
| 32 | onClick={async () => { |
| 33 | if (entry) { |
| 34 | await openFileInEditor(entry); |
| 35 | } |
| 36 | }} |
| 37 | > |
| 38 | <OpenInNew /> |
| 39 | </IconButton> |
| 40 | </div> |
| 41 | ); |
| 42 | } |
nothing calls this directly
no test coverage detected