Add LogList external styles

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2022-09-05 13:21:23 +03:00
1 parent 1679ba14e1
commit 2e0b4d15b3
2 files changed
+30 -17

No files matched your search

@@ -0,0 +1,24 @@
.LogList {
flex-grow: 1;
overflow: auto;
}
.virtualizer {
width: 100%;
position: relative;
}
.rowWrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
}
.lastLine {
width: 100%;
height: 1px;
bottom: 0;
background-color: red;
position: absolute;
}
+6 -17
View File
@@ -1,3 +1,5 @@
import styles from "./log-list.module.scss";
import { useVirtualizer } from '@tanstack/react-virtual'; import { useVirtualizer } from '@tanstack/react-virtual';
import AnsiUp from 'ansi_up'; import AnsiUp from 'ansi_up';
import DOMPurify from 'dompurify'; import DOMPurify from 'dompurify';
@@ -87,43 +89,30 @@ export const LogList = observer(({ model }: LogListProps) => {
return ( return (
<div <div
ref={parentRef} ref={parentRef}
style={{ className={styles.LogList}
flexGrow: 1,
overflow: 'auto', // Make it scroll!
}}
onScroll={onScroll} onScroll={onScroll}
> >
<div <div
style={{ style={{
height: `${rowVirtualizer.getTotalSize()}px`, height: `${rowVirtualizer.getTotalSize()}px`,
width: '100%',
position: 'relative',
}} }}
className={styles.virtualizer}
> >
{rowVirtualizer.getVirtualItems().map((virtualRow) => ( {rowVirtualizer.getVirtualItems().map((virtualRow) => (
<div <div
key={virtualRow.index} key={virtualRow.index}
ref={virtualRow.measureElement} ref={virtualRow.measureElement}
style={{ style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
transform: `translateY(${virtualRow.start}px)`, transform: `translateY(${virtualRow.start}px)`,
}} }}
className={styles.rowWrapper}
> >
<div> <div>
<LogRow rowIndex={virtualRow.index} model={model} /> <LogRow rowIndex={virtualRow.index} model={model} />
</div> </div>
</div> </div>
))} ))}
<div style={{ <div className={styles.lastLine}></div>
width: "100%",
height: "1px",
background: "red",
position: "absolute",
bottom: 0,
}}></div>
</div> </div>
</div> </div>
) )