refactor(chat): simplify input send button

This commit is contained in:
2026-07-01 12:42:26 +08:00
parent a80d68c1e4
commit eccb6d3074
3 changed files with 7 additions and 70 deletions
+4 -12
View File
@@ -8,38 +8,30 @@
* - 默认:粉色背景 + 渐变边缘
* - 聚焦 / 激活:完整 primaryGradientaccent → 透明)
*
* 图标:空输入显示 <Plus />,有内容时显示 <ArrowUp />
* 图标:固定显示 <ArrowUp />,按钮只负责发送消息。
*/
import { ArrowUp, Plus } from "lucide-react";
import { ArrowUp } from "lucide-react";
import styles from "./chat-send-button.module.css";
export interface ChatSendButtonProps {
disabled: boolean;
hasContent: boolean;
isExpanded?: boolean;
onClick: () => void;
}
export function ChatSendButton({
disabled,
hasContent,
isExpanded = false,
onClick,
}: ChatSendButtonProps) {
const Icon = hasContent ? ArrowUp : Plus;
const ariaLabel = hasContent ? "Send message" : "Open chat actions";
return (
<button
type="button"
className={`${styles.button} ${disabled ? "" : styles.buttonActive}`}
disabled={disabled}
onClick={onClick}
aria-expanded={hasContent ? undefined : isExpanded}
aria-label={ariaLabel}
aria-label="Send message"
>
<Icon className={styles.icon} size={24} aria-hidden="true" />
<ArrowUp className={styles.icon} size={24} aria-hidden="true" />
</button>
);
}