Files
asset-homepage/components/TrustedBySection.tsx

130 lines
3.4 KiB
TypeScript
Raw Normal View History

2026-01-27 17:26:30 +08:00
'use client';
import { useState, useEffect, useRef } from 'react';
import Image from 'next/image';
2026-01-28 17:55:01 +08:00
import { useLanguage } from '@/contexts/LanguageContext';
import ConsenSysLogo from './ConsenSysLogo';
2026-01-27 17:26:30 +08:00
export default function TrustedBySection() {
2026-01-28 17:55:01 +08:00
const { t } = useLanguage();
const [animate, setAnimate] = useState(false);
2026-01-27 17:26:30 +08:00
const sectionRef = useRef<HTMLElement>(null);
useEffect(() => {
2026-01-28 17:55:01 +08:00
const currentRef = sectionRef.current;
if (!currentRef) return;
2026-01-27 17:26:30 +08:00
const observer = new IntersectionObserver(
(entries) => {
2026-01-28 17:55:01 +08:00
if (entries[0].isIntersecting) {
setAnimate(true);
observer.disconnect(); // 触发后立即断开
}
2026-01-27 17:26:30 +08:00
},
2026-01-28 17:55:01 +08:00
{ threshold: 0.3 }
2026-01-27 17:26:30 +08:00
);
2026-01-28 17:55:01 +08:00
observer.observe(currentRef);
return () => observer.disconnect();
}, []);
2026-01-27 17:26:30 +08:00
2026-01-28 17:55:01 +08:00
// 合作伙伴 logo 数据 - 统一高度为40px
2026-01-27 17:26:30 +08:00
const partners = [
{
name: 'BlackRock',
src: '/nav-ireland0.svg',
2026-01-28 17:55:01 +08:00
width: 200,
height: 40,
className: 'w-[200px] h-[40px]'
2026-01-27 17:26:30 +08:00
},
{
name: 'Coinbase',
src: '/coinbase-10.svg',
2026-01-28 17:55:01 +08:00
width: 180,
height: 40,
className: 'w-[180px] h-[40px]'
2026-01-27 17:26:30 +08:00
},
{
name: 'Wintermute',
src: '/wintermute0.svg',
width: 247,
height: 40,
className: 'w-[247px] h-[40px]'
},
{
name: 'Circle',
src: '/group0.svg',
width: 156,
height: 40,
className: 'w-[156px] h-[40px]'
},
{
name: 'ConsenSys',
2026-01-28 17:55:01 +08:00
src: '', // 使用组合的vector文件
width: 220,
height: 50,
className: 'w-[220px] h-[50px]'
2026-01-27 17:26:30 +08:00
}
];
return (
<section
ref={sectionRef}
className="bg-[#f9fafb] flex flex-col items-center justify-center flex-shrink-0 w-full relative"
style={{
borderStyle: 'solid',
borderColor: '#e5e7eb',
borderWidth: '0px 0px 1px 0px',
padding: '80px 0px',
gap: '32px'
}}
>
{/* 标题 - .text6 */}
<div
className="text-[#111827] text-center relative flex items-center justify-center font-inter"
style={{
fontSize: '18px',
lineHeight: '150%',
fontWeight: 500
}}
>
2026-01-28 17:55:01 +08:00
{t('trusted.title')}
2026-01-27 17:26:30 +08:00
</div>
{/* Logo容器 - .frame-26 */}
<div
2026-01-28 17:55:01 +08:00
className="flex flex-row items-center justify-between flex-shrink-0 w-[1440px] relative"
2026-01-27 17:26:30 +08:00
>
{partners.map((partner, index) => (
<div
key={partner.name}
className={`flex-shrink-0 relative overflow-hidden cursor-pointer hover:brightness-0 ${
2026-01-28 17:55:01 +08:00
animate
2026-01-27 17:26:30 +08:00
? 'translate-y-0 opacity-100'
: 'translate-y-12 opacity-0'
}`}
style={{
transition: `transform 0.7s ease-out ${index * 100}ms, opacity 0.7s ease-out ${index * 100}ms, filter 0.3s ease-out`,
2026-01-28 17:55:01 +08:00
width: `${partner.width}px`,
height: `${partner.height}px`,
2026-01-27 17:26:30 +08:00
aspectRatio: `${partner.width}/${partner.height}`
}}
>
2026-01-28 17:55:01 +08:00
{partner.name === 'ConsenSys' ? (
<ConsenSysLogo width={partner.width} height={partner.height} />
) : (
<Image
src={partner.src}
alt={partner.name}
width={partner.width}
height={partner.height}
className="w-full h-full object-contain"
/>
)}
2026-01-27 17:26:30 +08:00
</div>
))}
</div>
</section>
);
}