From 307cc0f6cf57ed7e14e374c000be3fb4a5055134 Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Sun, 7 Apr 2024 22:39:33 +0800 Subject: [PATCH] update(AutoScrollContainer): Add auto prop. --- src/components/common/AutoScrollContainer.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/common/AutoScrollContainer.tsx b/src/components/common/AutoScrollContainer.tsx index 0d01241..6c9fa78 100644 --- a/src/components/common/AutoScrollContainer.tsx +++ b/src/components/common/AutoScrollContainer.tsx @@ -2,12 +2,12 @@ /** * 滚动容器 - * TODO: 自定义滚动速度 */ import React, { useRef, useEffect, useState } from 'react'; interface TextScrollProps { + auto?: boolean; hover?: boolean; speed?: number; width: string; @@ -17,10 +17,11 @@ interface TextScrollProps { const TextScroll: React.FC = ({ width = '100px', + auto = false, className = '', children = '', hover = false, - speed = 30, + speed = 5, }) => { const containerRef = useRef(null); const childrenRef = useRef(null); @@ -62,7 +63,11 @@ const TextScroll: React.FC = ({ onMouseEnter={() => handleMouseMove(true)} onMouseLeave={() => handleMouseMove(false)} > -
+
{children} {isOverflowing && ( <>