|
@@ -1,4 +1,5 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
|
|
+import { IndustryType } from './icons/IndustryIcon';
|
|
|
|
|
|
|
|
// 定义弹出框数据类型
|
|
// 定义弹出框数据类型
|
|
|
interface PopupData {
|
|
interface PopupData {
|
|
@@ -15,13 +16,28 @@ interface PopupInfoBoxProps {
|
|
|
data?: PopupData;
|
|
data?: PopupData;
|
|
|
position?: { x: number; y: number };
|
|
position?: { x: number; y: number };
|
|
|
onClose?: () => void;
|
|
onClose?: () => void;
|
|
|
|
|
+ industry?: IndustryType;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 产业主题色映射
|
|
|
|
|
+const industryColors: Record<IndustryType, string> = {
|
|
|
|
|
+ "粮食": "text-lime-200",
|
|
|
|
|
+ "油脂": "text-[#f6b02e]",
|
|
|
|
|
+ "种业": "text-[#5def8b]",
|
|
|
|
|
+ "果蔬": "text-[#fff586]",
|
|
|
|
|
+ "畜牧": "text-[#f593a5]",
|
|
|
|
|
+ "水产": "text-[#6be9ff]",
|
|
|
|
|
+ "鲜食": "text-[#de7e66]",
|
|
|
|
|
+ "泛盐": "text-[#92a5fe]"
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const PopupInfoBox: React.FC<PopupInfoBoxProps> = ({
|
|
const PopupInfoBox: React.FC<PopupInfoBoxProps> = ({
|
|
|
data,
|
|
data,
|
|
|
position = { x: 717.28, y: 273.13 },
|
|
position = { x: 717.28, y: 273.13 },
|
|
|
- onClose
|
|
|
|
|
|
|
+ onClose,
|
|
|
|
|
+ industry = "粮食"
|
|
|
}) => {
|
|
}) => {
|
|
|
|
|
+ const themeColor = industryColors[industry];
|
|
|
// 默认数据
|
|
// 默认数据
|
|
|
const defaultData: PopupData = {
|
|
const defaultData: PopupData = {
|
|
|
title: "源头",
|
|
title: "源头",
|
|
@@ -61,7 +77,7 @@ const PopupInfoBox: React.FC<PopupInfoBoxProps> = ({
|
|
|
{/* 标题区域 */}
|
|
{/* 标题区域 */}
|
|
|
<div className="content-stretch flex flex-col gap-[12px] items-start relative shrink-0 w-full">
|
|
<div className="content-stretch flex flex-col gap-[12px] items-start relative shrink-0 w-full">
|
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
|
- <div className="flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] text-lime-200 whitespace-nowrap">
|
|
|
|
|
|
|
+ <div className={`flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] whitespace-nowrap ${themeColor}`}>
|
|
|
<p className="leading-[32px]">{displayData.title}</p>
|
|
<p className="leading-[32px]">{displayData.title}</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -82,7 +98,7 @@ const PopupInfoBox: React.FC<PopupInfoBoxProps> = ({
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
|
- <div className="flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] text-lime-200 whitespace-nowrap">
|
|
|
|
|
|
|
+ <div className={`flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] whitespace-nowrap ${themeColor}`}>
|
|
|
<p className="leading-[32px]">{displayData.metrics[0]?.value}</p>
|
|
<p className="leading-[32px]">{displayData.metrics[0]?.value}</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -100,7 +116,7 @@ const PopupInfoBox: React.FC<PopupInfoBoxProps> = ({
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
<div className="box-border content-stretch flex gap-[10px] items-center px-0 py-[4px] relative shrink-0">
|
|
|
- <div className="flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] text-lime-200 whitespace-nowrap">
|
|
|
|
|
|
|
+ <div className={`flex flex-col font-bold justify-center leading-[0] not-italic relative shrink-0 text-[36px] whitespace-nowrap ${themeColor}`}>
|
|
|
<p className="leading-[32px]">{displayData.metrics[1]?.value}</p>
|
|
<p className="leading-[32px]">{displayData.metrics[1]?.value}</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|