File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
packages/react-hook-tracer/src/components Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -97,11 +97,18 @@ interface TraceOriginEntryProps {
97
97
traceOrigin : TraceOrigin
98
98
isHighlighted : boolean
99
99
}
100
- const TraceOriginEntry = ( { traceOrigin, isHighlighted } : TraceOriginEntryProps ) => (
101
- < div className = "trace-origin" data-is-highlighted = { isHighlighted } data-testid = "trace-origin" >
102
- < span className = "origin-type" > { traceOrigin . originType } </ span >
103
- { traceOrigin . label && < span className = "origin-label" > { `«${ traceOrigin . label } »` } </ span > }
104
- { traceOrigin . info && ':' }
105
- { traceOrigin . info && < span className = "origin-info" > { traceOrigin . info } </ span > }
106
- </ div >
107
- )
100
+ const TraceOriginEntry = ( { traceOrigin, isHighlighted } : TraceOriginEntryProps ) => {
101
+ const { originType, label, info } = traceOrigin
102
+
103
+ // To match the styles, the colon before info is added to typeStr if there's no label, and to labelStr if there is.
104
+ const typeStr = `${ originType } ${ info !== null && label === null ? ':' : '' } `
105
+ const labelStr = `«${ label } »${ info !== null ? ':' : '' } `
106
+
107
+ return (
108
+ < div className = "trace-origin" data-is-highlighted = { isHighlighted } data-testid = "trace-origin" >
109
+ < span className = "origin-type" > { typeStr } </ span >
110
+ { label !== null && < span className = "origin-label" > { labelStr } </ span > }
111
+ { info !== null && < span className = "origin-info" > { info } </ span > }
112
+ </ div >
113
+ )
114
+ }
You can’t perform that action at this time.
0 commit comments