diff --git a/components/TextInputArea.tsx b/components/TextInputArea.tsx index cb076da..b644825 100644 --- a/components/TextInputArea.tsx +++ b/components/TextInputArea.tsx @@ -220,7 +220,6 @@ const TextInputArea = forwardRef((props return (
- {/* 顶部工具栏 */} {hasTopBar && (
@@ -247,10 +246,9 @@ const TextInputArea = forwardRef((props
)} - {/* 核心卡片容器:完美适配 shadcn 风格的多行包裹框 */}
((props autoFocus={autoFocus} readOnly={readOnly} placeholder={placeholder} - className="w-full bg-transparent px-3 py-2.5 font-mono text-sm leading-relaxed text-foreground placeholder:text-muted-foreground focus:outline-none resize-none border-0 block" + className="w-full bg-transparent px-4 py-3 font-mono text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/50 focus:outline-none resize-none border-0 block" {...restProps} /> - {/* 底部隔离式功能区:杜绝重叠和塌陷 */} {hasBottomBar && ( -
-
+
+ {/* 左侧自定义动作 */} +
{bottomActions.map((action) => ( ((props ))}
-
+ {/* 右侧系统按钮组 */} +
{allowCopy && value && ( @@ -299,9 +296,7 @@ const TextInputArea = forwardRef((props @@ -311,7 +306,7 @@ const TextInputArea = forwardRef((props )}
- {/* 错误提示区域 */} + {/* 错误提示 */} {displayError && (

{displayError} diff --git a/pages/TextStatistics/index.tsx b/pages/TextStatistics/index.tsx index 9f44c9d..6720a14 100644 --- a/pages/TextStatistics/index.tsx +++ b/pages/TextStatistics/index.tsx @@ -3,15 +3,10 @@ import { FileText } from 'lucide-react'; import PageHeader from '@/components/PageHeader'; import TextInputArea from '@/components/TextInputArea'; import { formatByteSize, getTextStats } from '@/utils/textStatistics'; -import { textStatisticsPageStyles } from '@/config/pageTheme'; import { useLazyTranslation } from '@/utils/useLazyTranslation'; import { useContextMenuData } from '@/utils/useContextMenuData'; +import { cn } from '@/lib/utils'; -/** - * 文本统计页面组件 - * - * 提供实时的文本分析功能,包括字符数、单词数、行数和字节大小。 - */ export default function Index() { const { t } = useLazyTranslation('textStatistics'); const [text, setText] = useState(''); @@ -22,8 +17,7 @@ export default function Index() { useContextMenuData({ featureKey: 'textStatistics', onData: handleContextMenuData }); - // 实时计算统计信息,使用 useMemo 优化性能 - // 对于 10,000 字符以上的文本,Intl.Segmenter 也能保持良好的性能 + // 实时计算统计信息,由 useMemo 拦截非必要计算 const stats = useMemo(() => getTextStats(text), [text]); const statItems = [ @@ -34,49 +28,45 @@ export default function Index() { ]; return ( -

-
- {/* 头部区域 */} - } - iconColor={textStatisticsPageStyles.primaryColor} - /> +
+ {/* 头部区域 */} + } + iconColor="text-purple-500" + /> - {/* 文本输入区域 */} - + {/* 文本输入区域 */} + - {/* 统计结果展示区域 */} -
- {statItems.map((item) => ( -
- - {item.label} - - - {item.value} - -
- ))} -
+ {/* 统计结果展示区域 */} +
+ {statItems.map((item) => ( +
+ + {item.label} + + + {item.value} + +
+ ))}
);