@@ -71,12 +71,25 @@ readyPartnersData();
7171
7272export function Trusted ( ) {
7373 const [ activeTab , setActiveTab ] = useState ( 'Company' ) ;
74+ const [ showAll , setShowAll ] = useState ( false ) ;
7475 const tabRefs = useRef ( { } ) ;
7576 const indicatorRef = useRef ( null ) ;
7677 const containerRef = useRef ( null ) ;
7778 const scrollContainerRef = useRef ( null ) ;
7879
7980 const currentPartners = partnersData [ activeTab ] || [ ] ;
81+
82+ // 移动端最多显示20个(10行 x 2列)
83+ const MOBILE_MAX_DISPLAY = 20 ;
84+ const shouldShowMore = currentPartners . length > MOBILE_MAX_DISPLAY ;
85+ const displayedPartners = shouldShowMore && ! showAll
86+ ? currentPartners . slice ( 0 , MOBILE_MAX_DISPLAY )
87+ : currentPartners ;
88+
89+ // 切换 tab 时重置显示状态
90+ useLayoutEffect ( ( ) => {
91+ setShowAll ( false ) ;
92+ } , [ activeTab ] ) ;
8093
8194 useLayoutEffect ( ( ) => {
8295 const updateIndicator = ( ) => {
@@ -169,18 +182,31 @@ export function Trusted() {
169182
170183 { /* Partners Grid */ }
171184 { currentPartners . length > 0 ? (
172- < div className = "flex flex-wrap justify-center gap-3 mb-6" >
173- { currentPartners . map ( ( partner , index ) => (
174- < div
175- key = { `partner-${ activeTab } -${ index } ` }
176- className = "trusted-box group border border-[rgba(26,26,26,0.1)] rounded-[1000px] px-4 py-7 flex justify-center items-center bg-white transition-colors max-md:px-3 max-md:py-6 h-24 max-md:h-20 w-full sm:w-[calc((100%-0.75rem)/2)] md:w-[calc((100%-1.5rem)/3)] lg:w-[calc((100%-2.25rem)/4)] xl:w-[calc((100%-3rem)/5)] 2xl:w-[calc((100%-3.75rem)/6)] flex-shrink-0"
177- >
178- < div className = "flex justify-center items-center w-full h-full [&>svg]:max-w-full [&>svg]:h-8 [&>svg]:w-auto" >
179- { partner . ele }
185+ < >
186+ < div className = "flex flex-wrap justify-center gap-3 mb-6" >
187+ { displayedPartners . map ( ( partner , index ) => (
188+ < div
189+ key = { `partner-${ activeTab } -${ index } ` }
190+ className = "trusted-box group border border-[rgba(26,26,26,0.1)] rounded-[1000px] px-4 py-7 flex justify-center items-center bg-white transition-colors max-md:px-3 max-md:py-6 h-24 max-md:h-20 w-full w-[calc((100%-0.75rem)/2)] md:w-[calc((100%-1.5rem)/3)] lg:w-[calc((100%-2.25rem)/4)] xl:w-[calc((100%-3rem)/5)] 2xl:w-[calc((100%-3.75rem)/6)] flex-shrink-0"
191+ >
192+ < div className = "flex justify-center items-center w-full h-full [&>svg]:max-w-full [&>svg]:h-8 [&>svg]:w-auto" >
193+ { partner . ele }
194+ </ div >
180195 </ div >
196+ ) ) }
197+ </ div >
198+ { /* 显示更多按钮 - 仅在移动端且超过20个时显示 */ }
199+ { shouldShowMore && (
200+ < div className = "flex justify-center mb-6 md:hidden" >
201+ < button
202+ onClick = { ( ) => setShowAll ( ! showAll ) }
203+ className = "px-6 py-3 text-base leading-[18px] font-medium text-black border border-[rgba(26,26,26,0.1)] rounded-[40px] bg-white hover:bg-[rgba(26,26,26,0.02)] transition-colors"
204+ >
205+ { showAll ? 'Show Less' : 'Show More' }
206+ </ button >
181207 </ div >
182- ) ) }
183- </ div >
208+ ) }
209+ </ >
184210 ) : (
185211 < div className = "py-12" >
186212 < p className = "text-base leading-8 text-[rgba(26,26,26,0.6)]" > No partners available in this category.</ p >
0 commit comments