refactor(chat): migrate simple bubble styles to tailwind

This commit is contained in:
2026-07-11 13:31:46 +08:00
parent bbe1825bb3
commit b426cc7a72
5 changed files with 57 additions and 64 deletions
+12 -2
View File
@@ -8,17 +8,27 @@
* - AI 消息:白底黑字 + 左上角尖角
* - 用户消息:渐变(primaryGradient+ 白字 + 右上角尖角
*/
import styles from "./text-bubble.module.css";
export interface TextBubbleProps {
content: string;
isFromAI: boolean;
}
const BASE_CLASS_NAME =
"w-full self-stretch whitespace-pre-wrap break-words rounded-[var(--radius-xxl,24px)] px-[var(--spacing-4,16px)] py-[var(--spacing-3,12px)] text-[length:var(--chat-message-font-size,var(--responsive-body,16px))] leading-[var(--chat-message-line-height,1.5)] shadow-[var(--shadow-input-box,0_1px_2px_rgba(0,0,0,0.1))]";
const AI_CLASS_NAME =
"rounded-tl-none bg-white text-[var(--color-text-foreground,#000)]";
const USER_CLASS_NAME =
"rounded-tr-none bg-[linear-gradient(to_right,var(--color-button-gradient-start,#ff67e0),var(--color-button-gradient-end,#ff52a2))] text-white";
export function TextBubble({ content, isFromAI }: TextBubbleProps) {
return (
<div
className={`${styles.bubble} ${isFromAI ? styles.bubbleAi : styles.bubbleUser}`}
className={[BASE_CLASS_NAME, isFromAI ? AI_CLASS_NAME : USER_CLASS_NAME]
.filter(Boolean)
.join(" ")}
>
{content}
</div>