1+ import type { Interpolation , Theme } from "@emotion/react" ;
12import type { LogLevel } from "api/typesGenerated" ;
23import type { FC , HTMLAttributes } from "react" ;
4+ import { MONOSPACE_FONT_FAMILY } from "theme/constants" ;
35import { cn } from "utils/cn" ;
46
57const DEFAULT_LOG_LINE_SIDE_PADDING = 24 ;
@@ -19,31 +21,7 @@ type LogLineProps = {
1921export const LogLine : FC < LogLineProps > = ( { level, ...divProps } ) => {
2022 return (
2123 < pre
22- css = { ( theme ) => ( {
23- padding : `0 var(--log-line-side-padding, ${ DEFAULT_LOG_LINE_SIDE_PADDING } px)` ,
24- "&.error" : {
25- backgroundColor : theme . roles . error . background ,
26- color : theme . roles . error . text ,
27- "& .dashed-line" : {
28- backgroundColor : theme . roles . error . outline ,
29- } ,
30- } ,
31- "&.debug" : {
32- backgroundColor : theme . roles . notice . background ,
33- color : theme . roles . notice . text ,
34- "& .dashed-line" : {
35- backgroundColor : theme . roles . notice . outline ,
36- } ,
37- } ,
38- "&.warn" : {
39- backgroundColor : theme . roles . warning . background ,
40- color : theme . roles . warning . text ,
41-
42- "& .dashed-line" : {
43- backgroundColor : theme . roles . warning . outline ,
44- } ,
45- } ,
46- } ) }
24+ css = { styles . line }
4725 { ...divProps }
4826 className = { cn (
4927 "m-0 break-all flex items-center text-[13px]" ,
@@ -67,3 +45,44 @@ export const LogLinePrefix: FC<HTMLAttributes<HTMLSpanElement>> = (props) => {
6745 />
6846 ) ;
6947} ;
48+
49+ const styles = {
50+ line : ( theme ) => ( {
51+ margin : 0 ,
52+ wordBreak : "break-all" ,
53+ display : "flex" ,
54+ alignItems : "center" ,
55+ fontSize : 13 ,
56+ color : theme . palette . text . primary ,
57+ fontFamily : MONOSPACE_FONT_FAMILY ,
58+ height : "auto" ,
59+ padding : `0 var(--log-line-side-padding, ${ DEFAULT_LOG_LINE_SIDE_PADDING } px)` ,
60+
61+ "&.error" : {
62+ backgroundColor : theme . roles . error . background ,
63+ color : theme . roles . error . text ,
64+
65+ "& .dashed-line" : {
66+ backgroundColor : theme . roles . error . outline ,
67+ } ,
68+ } ,
69+
70+ "&.debug" : {
71+ backgroundColor : theme . roles . notice . background ,
72+ color : theme . roles . notice . text ,
73+
74+ "& .dashed-line" : {
75+ backgroundColor : theme . roles . notice . outline ,
76+ } ,
77+ } ,
78+
79+ "&.warn" : {
80+ backgroundColor : theme . roles . warning . background ,
81+ color : theme . roles . warning . text ,
82+
83+ "& .dashed-line" : {
84+ backgroundColor : theme . roles . warning . outline ,
85+ } ,
86+ } ,
87+ } ) ,
88+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments