-
-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add criteria status color; increase message length (#2382)
- Loading branch information
1 parent
2d77c56
commit fe29032
Showing
5 changed files
with
61 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
client/src/modules/CrossCheck/utils/getCriteriaStatusColor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const colors = ['transparent', 'rgba(255, 0, 0, .05)', 'rgba(0, 255, 0, .05)', 'rgba(255, 255, 0, .05)'] as const; | ||
|
||
export function getCriteriaStatusColor(score: number, maxScore?: number) { | ||
const [transparent, red, green, yellow] = colors; | ||
|
||
if (!maxScore) { | ||
return transparent; | ||
} | ||
|
||
if (score === 0) { | ||
return red; | ||
} | ||
|
||
if (score < maxScore) { | ||
return yellow; | ||
} | ||
|
||
if (score === maxScore) { | ||
return green; | ||
} | ||
|
||
return transparent; | ||
} |