-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathLogViewer.tsx
More file actions
38 lines (32 loc) · 795 Bytes
/
LogViewer.tsx
File metadata and controls
38 lines (32 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { VscodeScrollable } from "@vscode-elements/react-elements";
import { useFollowScroll } from "../hooks/useFollowScroll";
import type { ReactNode } from "react";
interface LogViewerProps {
header: ReactNode;
children: ReactNode;
}
export function LogViewer({ header, children }: LogViewerProps) {
const bottomRef = useFollowScroll();
return (
<div className="log-viewer">
<div className="log-viewer-header">{header}</div>
<VscodeScrollable className="log-viewer-content">
{children}
<div ref={bottomRef} />
</VscodeScrollable>
</div>
);
}
export function LogViewerPlaceholder({
children,
error,
}: {
children: string;
error?: boolean;
}) {
return (
<div className={`log-viewer-empty${error ? " log-viewer-error" : ""}`}>
{children}
</div>
);
}