news/app/components/news/body/Integrated.tsx

89 lines
3.7 KiB
TypeScript
Raw Normal View History

2025-11-18 17:17:06 +08:00
import type { IconType } from 'react-icons';
import {
FaUserGraduate,
FaUserShield,
FaLaptopCode,
FaMicrophoneLines,
FaEnvelopeOpenText,
FaWrench,
FaRegFileLines,
FaSpellCheck,
FaChartPie,
FaGlobe,
FaBookOpenReader,
FaPenRuler,
} from 'react-icons/fa6';
2025-11-19 08:13:30 +08:00
// 定义服务项的类型接口
2025-11-18 17:17:06 +08:00
type ServiceItem = {
2025-11-19 08:13:30 +08:00
icon: IconType; // 图标组件
label: string; // 显示标签
href: string; // 链接地址
2025-11-18 17:17:06 +08:00
};
2025-11-19 08:13:30 +08:00
// 服务项数据数组
2025-11-18 17:17:06 +08:00
const services: ServiceItem[] = [
{ icon: FaUserGraduate, label: '警队自考', href: '/study' },
{ icon: FaUserShield, label: '警队教育', href: '/scholarship' },
{ icon: FaLaptopCode, label: '常用软件', href: '/software' },
{ icon: FaMicrophoneLines, label: '智能语音', href: '/voice' },
{ icon: FaEnvelopeOpenText, label: '蓝天邮局', href: '/mail' },
{ icon: FaWrench, label: '策划工具', href: '/plan' },
{ icon: FaRegFileLines, label: '办公模板', href: '/office' },
{ icon: FaSpellCheck, label: '智能校对', href: '/ai-check' },
{ icon: FaChartPie, label: '警情调研', href: '/survey' },
{ icon: FaGlobe, label: '上网助手', href: '/net' },
{ icon: FaBookOpenReader, label: '考试平台', href: '/exam' },
{ icon: FaPenRuler, label: '学习平台', href: '/study' },
];
2025-11-19 08:13:30 +08:00
// 将一维服务数组转换为三维数组分为3列每列4个服务项
// 结构: [[列1的4项], [列2的4项], [列3的4项]]
2025-11-18 17:17:06 +08:00
const columns = Array.from({ length: 3 }, (_, colIndex) =>
services.slice(colIndex * 4, colIndex * 4 + 4)
);
export default function Integrated() {
return (
2025-11-19 08:13:30 +08:00
// 主容器固定宽度1514px高度573px水平居中
2025-11-18 17:35:28 +08:00
<div className="w-[1514px] h-[573px] mx-auto ">
2025-11-19 08:13:30 +08:00
{/* 内容容器全宽高度488px */}
2025-11-18 17:17:06 +08:00
<div className="w-full h-[488px]">
2025-11-19 08:13:30 +08:00
{/* 标题栏全宽高度82px使用flex布局垂直居中内容 */}
2025-11-18 17:17:06 +08:00
<div className="w-full h-[82px] flex items-center pt-30 ml-10">
2025-11-19 08:13:30 +08:00
{/* 装饰性蓝色竖条 */}
2025-11-18 17:17:06 +08:00
<div className="w-3 h-15 bg-[#005d93] mr-3" />
2025-11-19 08:13:30 +08:00
{/* 标题文字深蓝色加粗4xl字号 */}
2025-11-18 17:17:06 +08:00
<h2 className="text-4xl font-bold text-[#005d93]"></h2>
</div>
2025-11-19 08:13:30 +08:00
{/* 服务项容器使用flex布局排列三列列间距45px设置内边距 */}
2025-11-18 17:17:06 +08:00
<div className="flex gap-45 h-full px-8 py-6 pb-20 pt-15">
2025-11-19 08:13:30 +08:00
{/* 遍历三列数据 */}
2025-11-18 17:17:06 +08:00
{columns.map((group, colIdx) => (
2025-11-19 08:13:30 +08:00
// 每列容器flex-1平均分配宽度使用2列网格布局设置网格间距
2025-11-18 17:17:06 +08:00
<div key={colIdx} className="flex-1 grid grid-cols-2 gap-x-8 gap-y-6">
2025-11-19 08:13:30 +08:00
{/* 遍历当前列中的服务项 */}
2025-11-18 17:17:06 +08:00
{group.map((service) => (
2025-11-19 08:13:30 +08:00
// 服务项链接使用flex垂直排列内容居中对齐设置悬停效果
2025-11-18 17:17:06 +08:00
<a
key={service.label}
href={service.href}
className="flex flex-col items-center text-[#0f172a] transition hover:text-[#005d93]"
>
2025-11-19 08:13:30 +08:00
{/* 图标容器固定尺寸16x16圆形背景flex居中图标下边距2px */}
2025-11-18 17:17:06 +08:00
<div className="w-16 h-16 flex items-center justify-center rounded-full bg-[#005d93]/10 text-[#005d93] mb-2">
2025-11-19 08:13:30 +08:00
{/* 图标尺寸8x8隐藏无障碍访问标签 */}
2025-11-18 17:17:06 +08:00
<service.icon className="w-8 h-8" aria-hidden />
</div>
2025-11-19 08:13:30 +08:00
{/* 服务标签:基础字体大小,半粗体,文字居中 */}
2025-11-18 17:17:06 +08:00
<span className="text-base font-semibold text-center">{service.label}</span>
</a>
))}
</div>
))}
</div>
</div>
</div>
);
}