kyd-shared-badge 0.1.16 → 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.16",
3
+ "version": "0.1.18",
4
4
  "private": false,
5
5
  "main": "./src/index.ts",
6
6
  "module": "./src/index.ts",
@@ -9,6 +9,8 @@ import ReportHeader from './components/ReportHeader';
9
9
  import AppendixTables from './components/AppendixTables';
10
10
  import ProviderInsights from './components/ProviderInsights';
11
11
  import IpRiskAnalysisDisplay from './components/IpRiskAnalysisDisplay';
12
+ import Image from 'next/image';
13
+ import { red, yellow, green } from './colors';
12
14
 
13
15
  // Icon images from this package's public folder (will be bundled as assets)
14
16
  import RiskGreen from './public/riskgreen.png';
@@ -22,9 +24,9 @@ import AiYellow from './public/aiyellow.png';
22
24
  import AiRed from './public/aired.png';
23
25
 
24
26
  const getScoreColor = (score: number) => {
25
- if (score >= 80) return 'text-[#6A9846]';
26
- if (score >= 65) return 'text-[#EABE52]';
27
- return 'text-[#D3452E]';
27
+ if (score >= 80) return green;
28
+ if (score >= 65) return yellow;
29
+ return red;
28
30
  };
29
31
 
30
32
  const getRiskText = (risk: number) => {
@@ -71,7 +73,9 @@ interface ScoreCardProps {
71
73
  }
72
74
 
73
75
  const ScoreCard = ({ title, score, description, descriptor, icon: Icon, scoreType, isRecruiter = false, iconImageSrc }: ScoreCardProps) => {
74
- 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' : '';
75
79
  let displayScore;
76
80
 
77
81
  if (scoreType === 'risk') {
@@ -91,16 +95,16 @@ const ScoreCard = ({ title, score, description, descriptor, icon: Icon, scoreTyp
91
95
  }
92
96
  style={isRecruiter ? { backgroundColor: 'var(--content-card-background)', borderColor: 'var(--icon-button-secondary)' } : undefined}
93
97
  >
94
- <div className={`text-3xl mb-4 ${scoreColor}`}>
98
+ <div className={`text-3xl mb-4 ${scoreClass}`} style={scoreHex ? { color: scoreHex } : undefined}>
95
99
  {iconImageSrc ? (
96
100
  // eslint-disable-next-line @next/next/no-img-element
97
- <img src={iconImageSrc} alt="icon" className="h-8 w-8 object-contain" />
101
+ <Image src={iconImageSrc} alt="icon" className="h-8 w-8 object-contain" />
98
102
  ) : (
99
103
  <Icon />
100
104
  )}
101
105
  </div>
102
- <h3 className={`font-semibold text-xl ${scoreType === 'descriptor' ? 'text-neutral-400' : ''}`} style={isRecruiter ? { color: 'var(--text-main)' } : undefined}>{title}</h3>
103
- <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>
104
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>
105
109
  </div>
106
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 }