kyd-shared-badge 0.1.17 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kyd-shared-badge",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -10,6 +10,7 @@ import AppendixTables from './components/AppendixTables';
10
10
  import ProviderInsights from './components/ProviderInsights';
11
11
  import IpRiskAnalysisDisplay from './components/IpRiskAnalysisDisplay';
12
12
  import Image from 'next/image';
13
+ import { red, yellow, green } from './colors';
13
14
 
14
15
  // Icon images from this package's public folder (will be bundled as assets)
15
16
  import RiskGreen from './public/riskgreen.png';
@@ -23,9 +24,9 @@ import AiYellow from './public/aiyellow.png';
23
24
  import AiRed from './public/aired.png';
24
25
 
25
26
  const getScoreColor = (score: number) => {
26
- if (score >= 80) return 'text-[#6A9846]';
27
- if (score >= 65) return 'text-[#EABE52]';
28
- return 'text-[#D3452E]';
27
+ if (score >= 80) return green;
28
+ if (score >= 65) return yellow;
29
+ return red;
29
30
  };
30
31
 
31
32
  const getRiskText = (risk: number) => {
@@ -72,7 +73,9 @@ interface ScoreCardProps {
72
73
  }
73
74
 
74
75
  const ScoreCard = ({ title, score, description, descriptor, icon: Icon, scoreType, isRecruiter = false, iconImageSrc }: ScoreCardProps) => {
75
- const scoreColor = scoreType === 'descriptor' ? 'text-neutral-400' : getScoreColor(score);
76
+ const isDescriptor = scoreType === 'descriptor';
77
+ const scoreHex = isDescriptor ? undefined : getScoreColor(score);
78
+ const scoreClass = isDescriptor ? 'text-neutral-400' : '';
76
79
  let displayScore;
77
80
 
78
81
  if (scoreType === 'risk') {
@@ -92,7 +95,7 @@ const ScoreCard = ({ title, score, description, descriptor, icon: Icon, scoreTyp
92
95
  }
93
96
  style={isRecruiter ? { backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' } : undefined}
94
97
  >
95
- <div className={`text-3xl mb-4 ${scoreColor}`}>
98
+ <div className={`text-3xl mb-4 ${scoreClass}`} style={scoreHex ? { color: scoreHex } : undefined}>
96
99
  {iconImageSrc ? (
97
100
  // eslint-disable-next-line @next/next/no-img-element
98
101
  <Image src={iconImageSrc} alt="icon" className="h-8 w-8 object-contain" />
@@ -100,8 +103,8 @@ const ScoreCard = ({ title, score, description, descriptor, icon: Icon, scoreTyp
100
103
  <Icon />
101
104
  )}
102
105
  </div>
103
- <h3 className={`font-semibold text-xl ${scoreType === 'descriptor' ? 'text-neutral-400' : ''}`} style={isRecruiter ? { color: 'var(--text-main)' } : undefined}>{title}</h3>
104
- <p className={`text-4xl font-bold ${scoreColor}`}>{displayScore}</p>
106
+ <h3 className={`font-semibold text-xl ${isDescriptor ? 'text-neutral-400' : ''}`} style={isRecruiter ? { color: 'var(--text-main)' } : undefined}>{title}</h3>
107
+ <p className={`text-4xl font-bold ${scoreClass}`} style={scoreHex ? { color: scoreHex } : undefined}>{displayScore}</p>
105
108
  <p className={isRecruiter ? 'text-sm mt-4' : 'text-sm text-neutral-600 dark:text-neutral-400 mt-4'} style={isRecruiter ? { color: 'var(--text-secondary)' } : undefined}>{description}</p>
106
109
  </div>
107
110
  );
package/src/colors.ts CHANGED
@@ -1,26 +1,5 @@
1
- const redColors = [
2
- '#EC6662',
3
- '#F1908C',
4
- '#F5B7B3',
5
- '#FADBDA',
6
- '#FDF0EF',
7
- ]
1
+ const red = '#EC6662'
2
+ const yellow = '#ffbb54'
3
+ const green = '#49a08a'
8
4
 
9
-
10
- const yellowColors = [
11
- '#FADBDA',
12
- '#F2CA8C',
13
- '#F9DFB6',
14
- '#FDEFDB',
15
- '#FEF9F0',
16
- ]
17
-
18
- const greenColors = [
19
- '#48A08A',
20
- '#7BB9AA',
21
- '#A5CCC2',
22
- '#D5E8E2',
23
- '#EEF6F4',
24
- ]
25
-
26
- export { redColors, yellowColors, greenColors }
5
+ export { red, yellow, green }