1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Add LogList external styles

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

View File

@ -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;
}

View File

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