fix: make sparkline strokes the same thickness (#1527)

* fix: make sparkline strokes the same thickness

* fix: data test id in sparkline
This commit is contained in:
Matthew Russell 2022-09-29 07:20:04 -07:00 committed by GitHub
parent 93c1835cd6
commit 65af6bc0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,6 +81,13 @@ export const SparklineView = ({
// Create paths
const preMarketCreationPath = lineSeries(preMarketData);
const mainPath = lineSeries(marketData);
const pathProps = {
'data-testid': 'sparkline-path',
className: `[vector-effect:non-scaling-stroke] ${strokeClassName}`,
stroke: 'strokeCurrent',
strokeWidth: 1,
fill: 'transparent',
};
return (
<svg
@ -92,25 +99,9 @@ export const SparklineView = ({
preserveAspectRatio="none"
>
{preMarketCreationPath && (
<path
data-testid="sparkline-path"
className={`[vector-effect:non-scaling-stroke] ${strokeClassName}`}
d={preMarketCreationPath}
stroke="strokeCurrent"
strokeWidth={1}
fill="transparent"
/>
)}
{mainPath && (
<path
data-testid="sparkline-path"
d={mainPath}
className={`[vector-effect:non-scaling-stroke] ${strokeClassName}`}
stroke="strokeCurrent"
strokeWidth={2}
fill="transparent"
/>
<path {...pathProps} d={preMarketCreationPath} />
)}
{mainPath && <path {...pathProps} d={mainPath} />}
</svg>
);
};