Skip to content

Commit 44f326b

Browse files
authored
Add check for default color (#3194)
1 parent 3acdbb1 commit 44f326b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/lib/components/lines-and-dots/constants.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ export const getNextDistanceAndOffset = (
214214
return { nextDistance, offset };
215215
};
216216

217+
export const DEFAULT_STROKE_COLOR = 'currentColor';
218+
217219
export const getStatusStrokeColor = (
218220
status: WorkflowStatus | EventClassification | 'Delayed',
219221
): string => {
@@ -236,7 +238,7 @@ export const getStatusStrokeColor = (
236238
case 'Delayed':
237239
return '#fbbf24';
238240
default:
239-
return 'currentColor';
241+
return DEFAULT_STROKE_COLOR;
240242
}
241243
};
242244

@@ -263,7 +265,7 @@ export const getCategoryStrokeColor = (
263265
case 'retry':
264266
return '#FF9B70';
265267
default:
266-
return 'currentColor';
268+
return DEFAULT_STROKE_COLOR;
267269
}
268270
};
269271

src/lib/components/lines-and-dots/svg/line.svelte

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import {
3+
DEFAULT_STROKE_COLOR,
34
getCategoryStrokeColor,
45
getStatusStrokeColor,
56
} from '$lib/components/lines-and-dots/constants';
@@ -46,15 +47,17 @@
4647
);
4748
4849
const strokeColor = $derived.by(() => {
49-
let color = 'currentColor';
50+
let color = DEFAULT_STROKE_COLOR;
5051
if (status) {
5152
color = status === 'none' ? '#141414' : getStatusStrokeColor(status);
5253
}
5354
if (category) {
54-
color = getCategoryStrokeColor(category);
55+
const categoryColor = getCategoryStrokeColor(category);
56+
if (categoryColor !== DEFAULT_STROKE_COLOR) color = categoryColor;
5557
}
5658
if (classification) {
57-
color = getStatusStrokeColor(classification);
59+
const statusColor = getStatusStrokeColor(classification);
60+
if (statusColor !== DEFAULT_STROKE_COLOR) color = statusColor;
5861
}
5962
if (delayed && [classification, status].includes('Running')) {
6063
color = getStatusStrokeColor('Delayed');

0 commit comments

Comments
 (0)