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

89 lines
3.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { IconType } from 'react-icons';
import {
FaUserGraduate,
FaUserShield,
FaLaptopCode,
FaMicrophoneLines,
FaEnvelopeOpenText,
FaWrench,
FaRegFileLines,
FaSpellCheck,
FaChartPie,
FaGlobe,
FaBookOpenReader,
FaPenRuler,
} from 'react-icons/fa6';
// 定义服务项的类型接口
type ServiceItem = {
icon: IconType; // 图标组件
label: string; // 显示标签
href: string; // 链接地址
};
// 服务项数据数组
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' },
];
// 将一维服务数组转换为三维数组分为3列每列4个服务项
// 结构: [[列1的4项], [列2的4项], [列3的4项]]
const columns = Array.from({ length: 3 }, (_, colIndex) =>
services.slice(colIndex * 4, colIndex * 4 + 4)
);
export default function Integrated() {
return (
// 主容器固定宽度1514px高度573px水平居中
<div className="w-[1514px] h-[573px] mx-auto ">
{/* 内容容器全宽高度488px */}
<div className="w-full h-[488px]">
{/* 标题栏全宽高度82px使用flex布局垂直居中内容 */}
<div className="w-full h-[82px] flex items-center pt-30 ml-10">
{/* 装饰性蓝色竖条 */}
<div className="w-3 h-15 bg-[#005d93] mr-3" />
{/* 标题文字深蓝色加粗4xl字号 */}
<h2 className="text-4xl font-bold text-[#005d93]"></h2>
</div>
{/* 服务项容器使用flex布局排列三列列间距45px设置内边距 */}
<div className="flex gap-45 h-full px-8 py-6 pb-20 pt-15">
{/* 遍历三列数据 */}
{columns.map((group, colIdx) => (
// 每列容器flex-1平均分配宽度使用2列网格布局设置网格间距
<div key={colIdx} className="flex-1 grid grid-cols-2 gap-x-8 gap-y-6">
{/* 遍历当前列中的服务项 */}
{group.map((service) => (
// 服务项链接使用flex垂直排列内容居中对齐设置悬停效果
<a
key={service.label}
href={service.href}
className="flex flex-col items-center text-[#0f172a] transition hover:text-[#005d93]"
>
{/* 图标容器固定尺寸16x16圆形背景flex居中图标下边距2px */}
<div className="w-16 h-16 flex items-center justify-center rounded-full bg-[#005d93]/10 text-[#005d93] mb-2">
{/* 图标尺寸8x8隐藏无障碍访问标签 */}
<service.icon className="w-8 h-8" aria-hidden />
</div>
{/* 服务标签:基础字体大小,半粗体,文字居中 */}
<span className="text-base font-semibold text-center">{service.label}</span>
</a>
))}
</div>
))}
</div>
</div>
</div>
);
}