Files
asset-homepage/components/TrustedBySection.tsx

125 lines
3.3 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';
2026-01-29 16:23:10 +08:00
import { useTheme } from '@/contexts/ThemeContext';
2026-01-28 17:55:01 +08:00
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();
2026-01-29 16:23:10 +08:00
const { theme } = useTheme();
2026-01-28 17:55:01 +08:00
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);
2026-01-29 16:23:10 +08:00
observer.disconnect();
2026-01-28 17:55:01 +08:00
}
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-29 16:23:10 +08:00
const isDark = theme === 'dark';
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,
2026-01-29 16:23:10 +08:00
height: 40
2026-01-27 17:26:30 +08:00
},
{
name: 'Coinbase',
src: '/coinbase-10.svg',
2026-01-28 17:55:01 +08:00
width: 180,
2026-01-29 16:23:10 +08:00
height: 40
2026-01-27 17:26:30 +08:00
},
{
name: 'Wintermute',
src: '/wintermute0.svg',
width: 247,
2026-01-29 16:23:10 +08:00
height: 40
2026-01-27 17:26:30 +08:00
},
{
name: 'Circle',
src: '/group0.svg',
width: 156,
2026-01-29 16:23:10 +08:00
height: 40
2026-01-27 17:26:30 +08:00
},
{
name: 'ConsenSys',
2026-01-29 16:23:10 +08:00
src: '',
2026-01-28 17:55:01 +08:00
width: 220,
2026-01-29 16:23:10 +08:00
height: 50
2026-01-27 17:26:30 +08:00
}
];
return (
<section
ref={sectionRef}
2026-01-29 16:23:10 +08:00
className={`flex flex-col items-center justify-center flex-shrink-0 w-full relative border-b ${
isDark ? 'bg-[#0a0a0a] border-[#27272a]' : 'bg-[#f9fafb] border-[#e5e7eb]'
}`}
2026-01-27 17:26:30 +08:00
style={{
padding: '80px 0px',
gap: '32px'
}}
>
<div
2026-01-29 16:23:10 +08:00
className={`text-lg font-medium text-center font-domine ${
isDark ? 'text-[#fafafa]' : 'text-[#111827]'
}`}
2026-01-27 17:26:30 +08:00
>
2026-01-28 17:55:01 +08:00
{t('trusted.title')}
2026-01-27 17:26:30 +08:00
</div>
2026-01-29 16:23:10 +08:00
<div 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}
2026-01-29 16:23:10 +08:00
className={`flex-shrink-0 relative overflow-hidden cursor-pointer transition-all ${
animate ? 'translate-y-0 opacity-100' : 'translate-y-12 opacity-0'
} ${
isDark
? 'hover:brightness-200 hover:invert'
: 'hover:brightness-0'
2026-01-27 17:26:30 +08:00
}`}
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-29 16:23:10 +08:00
style={{
filter: isDark ? 'brightness(0) invert(1)' : 'brightness(0)'
}}
2026-01-28 17:55:01 +08:00
/>
)}
2026-01-27 17:26:30 +08:00
</div>
))}
</div>
</section>
);
}