Skip to content

Commit e61e28a

Browse files
authored
style: add dpp icons (#801)
1 parent b63155d commit e61e28a

File tree

14 files changed

+124
-32
lines changed

14 files changed

+124
-32
lines changed

components/partials/project/[id]/GC1DPP.tsx

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface CategoryConfig {
4949
key: keyof DPPData;
5050
title: string;
5151
subtitle: string;
52+
iconColor: string;
5253
}
5354

5455
interface GC1DPPProps {
@@ -60,61 +61,73 @@ const categoryConfigs: CategoryConfig[] = [
6061
key: "productOverview",
6162
title: "DPP Overview",
6263
subtitle: "Basic product information and identification",
64+
iconColor: "bg-[rgba(43,127,255,0.1)]",
6365
},
6466
{
6567
key: "complianceAndStandards",
6668
title: "Compliance and Standards",
6769
subtitle: "Regulatory compliance information",
70+
iconColor: "bg-[rgba(241,189,77,0.1)]",
6871
},
6972
{
7073
key: "reparability",
7174
title: "Repairability",
7275
subtitle: "Information about product repair and spare parts",
76+
iconColor: "bg-[rgba(173,70,255,0.1)]",
7377
},
7478
{
7579
key: "environmentalImpact",
7680
title: "Environmental Impact",
7781
subtitle: "Resource consumption and emissions data",
82+
iconColor: "bg-[rgba(3,106,83,0.1)]",
7883
},
7984
{
8085
key: "certificates",
8186
title: "Certificates",
8287
subtitle: "Environmental and quality certifications",
88+
iconColor: "bg-[rgba(241,189,77,0.1)]",
8389
},
8490
{
8591
key: "recyclability",
8692
title: "Recyclability",
8793
subtitle: "Material composition and recycling information",
94+
iconColor: "bg-[rgba(3,106,83,0.1)]",
8895
},
8996
{
9097
key: "energyUseAndEfficiency",
9198
title: "Energy Use & Efficiency",
9299
subtitle: "Battery and power specifications",
100+
iconColor: "bg-[rgba(240,177,0,0.1)]",
93101
},
94102
{
95103
key: "components",
96104
title: "Component Information",
97105
subtitle: "Component-level compliance data",
106+
iconColor: "bg-[rgba(200,212,229,0.5)]",
98107
},
99108
{
100109
key: "economicOperator",
101110
title: "Economic Operator",
102111
subtitle: "Manufacturer and company information",
112+
iconColor: "bg-[rgba(43,127,255,0.1)]",
103113
},
104114
{
105115
key: "repairInformation",
106116
title: "Information about the Repair",
107117
subtitle: "Repair history and documentation",
118+
iconColor: "bg-[rgba(173,70,255,0.1)]",
108119
},
109120
{
110121
key: "refurbishmentInformation",
111122
title: "Information about the Refurbishment",
112123
subtitle: "Refurbishment history and processes",
124+
iconColor: "bg-[rgba(43,127,255,0.1)]",
113125
},
114126
{
115127
key: "recyclingInformation",
116128
title: "Information on the Recycling",
117129
subtitle: "End-of-life recycling data",
130+
iconColor: "bg-[rgba(3,106,83,0.1)]",
118131
},
119132
];
120133

@@ -183,6 +196,22 @@ const fieldNameMap: Record<string, string> = {
183196
dateOfRepair: "Date of Repair",
184197
};
185198

199+
// Icon mapping for each category
200+
const categoryIconMap: Record<string, string> = {
201+
productOverview: "overview",
202+
complianceAndStandards: "compliance",
203+
reparability: "repairability",
204+
environmentalImpact: "environment",
205+
certificates: "certificates",
206+
recyclability: "recycle",
207+
energyUseAndEfficiency: "energy",
208+
components: "component",
209+
economicOperator: "operator",
210+
repairInformation: "repairability",
211+
refurbishmentInformation: "refurbishment",
212+
recyclingInformation: "recycle",
213+
};
214+
186215
const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
187216
const { t } = useTranslation("common");
188217
const [data, setData] = useState<DPPData | null>(null);
@@ -242,7 +271,6 @@ const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
242271
};
243272

244273
const isAttachment = (value: any): value is AttachmentResponse => {
245-
console.log("Checking attachment:", value);
246274
return value && typeof value === "object" && "url" in value && "fileName" in value;
247275
};
248276

@@ -358,9 +386,7 @@ const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
358386
const displayName =
359387
fieldNameMap[key] || key.replace(/([A-Z])/g, " $1").replace(/^./, str => str.toUpperCase());
360388

361-
// Check if the field value is an attachment
362389
if (isAttachment(field.value[0])) {
363-
console.log("Attachment found:", field.value);
364390
return (
365391
<div key={key} className="md:col-span-2">
366392
<FileDisplay label={displayName} file={field.value[0]} />
@@ -411,6 +437,7 @@ const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
411437

412438
const CategorySection: React.FC<{ config: CategoryConfig; data: any }> = ({ config, data }) => {
413439
const isOpen = openSections[config.key];
440+
const iconName = categoryIconMap[config.key];
414441

415442
let hasData = false;
416443
if (config.key === "components") {
@@ -427,9 +454,18 @@ const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
427454
className="flex items-center justify-between px-6 py-5 cursor-pointer"
428455
onClick={() => handleToggle(config.key)}
429456
>
430-
<div className="flex flex-col gap-0">
431-
<h3 className="text-[#0b1324] text-xl font-bold font-display leading-[30px]">{t(config.title)}</h3>
432-
<p className="text-[#6c707c] text-sm font-normal font-sans leading-[21px]">{t(config.subtitle)}</p>
457+
<div className="flex items-center gap-3">
458+
{iconName && (
459+
<div
460+
className={`w-10 h-10 ${config.iconColor} rounded-[6px] flex items-center justify-center p-2 shrink-0`}
461+
>
462+
<img src={`/${iconName}.svg`} alt="" className="w-6 h-6" />
463+
</div>
464+
)}
465+
<div className="flex flex-col gap-0">
466+
<h3 className="text-[#0b1324] text-xl font-bold font-display leading-[30px]">{t(config.title)}</h3>
467+
<p className="text-[#6c707c] text-sm font-normal font-sans leading-[21px]">{t(config.subtitle)}</p>
468+
</div>
433469
</div>
434470
<div className="w-6 h-6 flex items-center justify-center text-gray-500">
435471
{isOpen ? <ChevronUpMinor className="w-6 h-6" /> : <ChevronDownMinor className="w-6 h-6" />}
@@ -478,32 +514,6 @@ const GC1DPP: React.FC<GC1DPPProps> = ({ ulid }) => {
478514
{/* Main Header */}
479515
<div className="bg-white border border-[#c9cccf] rounded-[8px] w-full p-6">
480516
<div className="flex items-center gap-3">
481-
<div className="w-10 h-10 bg-[#036A53]/10 rounded-[6px] flex items-center justify-center p-2">
482-
{/* Placeholder for the Passport Icon */}
483-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
484-
<path
485-
d="M12 2L2 7L12 12L22 7L12 2Z"
486-
stroke="#036A53"
487-
strokeWidth="2"
488-
strokeLinecap="round"
489-
strokeLinejoin="round"
490-
/>
491-
<path
492-
d="M2 17L12 22L22 17"
493-
stroke="#036A53"
494-
strokeWidth="2"
495-
strokeLinecap="round"
496-
strokeLinejoin="round"
497-
/>
498-
<path
499-
d="M2 12L12 17L22 12"
500-
stroke="#036A53"
501-
strokeWidth="2"
502-
strokeLinecap="round"
503-
strokeLinejoin="round"
504-
/>
505-
</svg>
506-
</div>
507517
<div className="flex flex-col">
508518
<h2 className="text-[#0b1324] text-2xl font-bold font-display leading-[36px]">{t("Product Passport")}</h2>
509519
<p className="text-[#6c707c] text-sm font-normal font-sans leading-[21px]">

public/certificates.svg

Lines changed: 12 additions & 0 deletions
Loading

public/compliance.svg

Lines changed: 9 additions & 0 deletions
Loading

public/compliance_2.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)