Pass styles to LogLineMessage

This commit is contained in:
Matias Chomicki 2025-02-14 13:02:43 +01:00
parent ce0d232946
commit d3c963ddb3
2 changed files with 19 additions and 8 deletions

View File

@ -136,7 +136,11 @@ export const InfiniteScroll = ({
({ index, style }: ListChildComponentProps) => {
if (!logs[index] && infiniteLoaderState !== 'idle') {
return (
<LogLineMessage style={style} onClick={infiniteLoaderState === 'pre-scroll' ? onLoadMore : undefined}>
<LogLineMessage
style={style}
styles={styles}
onClick={infiniteLoaderState === 'pre-scroll' ? onLoadMore : undefined}
>
{getMessageFromInfiniteLoaderState(infiniteLoaderState, sortOrder)}
</LogLineMessage>
);
@ -155,7 +159,17 @@ export const InfiniteScroll = ({
/>
);
},
[displayedFields, handleOverflow, infiniteLoaderState, logs, onLoadMore, showTime, sortOrder, styles, wrapLogMessage]
[
displayedFields,
handleOverflow,
infiniteLoaderState,
logs,
onLoadMore,
showTime,
sortOrder,
styles,
wrapLogMessage,
]
);
const onItemsRendered = useCallback(

View File

@ -1,18 +1,15 @@
import { CSSProperties, ReactNode } from 'react';
import { useTheme2 } from '@grafana/ui';
import { getStyles } from './LogLine';
import { LogLineStyles } from './LogLine';
interface Props {
children: ReactNode;
onClick?: () => void;
style: CSSProperties;
styles: LogLineStyles;
}
export const LogLineMessage = ({ children, onClick, style }: Props) => {
const theme = useTheme2();
const styles = getStyles(theme);
export const LogLineMessage = ({ children, onClick, style, styles }: Props) => {
return (
<div style={style} className={`${styles.logLine} ${styles.logLineMessage}`}>
{onClick ? (