refactor(components): 全局组件适配暗色主题
- 聊天页面 header 和输入区域背景色使用 CSS 变量 - ChatInput 输入框背景色适配 - ModelSelector/ToolsDropdown 下拉菜单背景色适配 - QuickActions 按钮背景色适配 - Sidebar 侧边栏及下拉菜单背景色适配 - UserMenu 悬停效果颜色适配
This commit is contained in:
parent
0b5b67174f
commit
aa469438c2
@ -207,7 +207,7 @@ export default function ChatPage({ params }: PageProps) {
|
||||
)}
|
||||
>
|
||||
{/* 固定顶部 Header */}
|
||||
<header className="h-[var(--header-height)] px-4 flex items-center justify-between border-b border-[var(--color-border)] bg-white sticky top-0 z-10">
|
||||
<header className="h-[var(--header-height)] px-4 flex items-center justify-between border-b border-[var(--color-border)] bg-[var(--color-bg-primary)] sticky top-0 z-10">
|
||||
<div className="flex items-center gap-3">
|
||||
<SidebarToggle onClick={() => setSidebarOpen(!sidebarOpen)} />
|
||||
<h1 className="text-base font-medium text-[var(--color-text-primary)] truncate max-w-[300px]">
|
||||
@ -280,7 +280,12 @@ export default function ChatPage({ params }: PageProps) {
|
||||
</div>
|
||||
|
||||
{/* 固定底部输入框 */}
|
||||
<div className="sticky bottom-0 bg-gradient-to-t from-white via-white to-transparent pt-4">
|
||||
<div
|
||||
className="sticky bottom-0 pt-4"
|
||||
style={{
|
||||
background: `linear-gradient(to top, var(--color-bg-secondary) 0%, var(--color-bg-secondary) 80%, transparent 100%)`
|
||||
}}
|
||||
>
|
||||
<div className="max-w-[900px] mx-auto px-4 pb-4">
|
||||
{isStreaming && (
|
||||
<div className="flex justify-center mb-3">
|
||||
|
||||
@ -52,7 +52,7 @@ export function ChatInput({
|
||||
<div className={cn('w-full max-w-[var(--input-max-width)] mx-auto', className)}>
|
||||
<div
|
||||
className={cn(
|
||||
'flex flex-col bg-white border border-[var(--color-border)] rounded-[18px] p-4 shadow-[var(--shadow-input)]',
|
||||
'flex flex-col bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-[18px] p-4 shadow-[var(--shadow-input)]',
|
||||
'transition-all duration-150',
|
||||
'focus-within:border-[var(--color-border-focus)] focus-within:shadow-[var(--shadow-input-focus)]'
|
||||
)}
|
||||
|
||||
@ -44,7 +44,7 @@ export function ModelSelector({ models, selectedModel, onSelect }: ModelSelector
|
||||
{/* 下拉菜单 */}
|
||||
<div
|
||||
className={cn(
|
||||
'absolute bottom-full right-0 mb-2 min-w-[160px] bg-white border border-[var(--color-border)] rounded-xl shadow-lg p-1 z-50',
|
||||
'absolute bottom-full right-0 mb-2 min-w-[160px] bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-xl shadow-lg p-1 z-50',
|
||||
'transition-all duration-150',
|
||||
isOpen
|
||||
? 'opacity-100 visible translate-y-0'
|
||||
|
||||
@ -29,7 +29,7 @@ export function QuickActions({ actions, onSelect, className }: QuickActionsProps
|
||||
onClick={() => onSelect(action)}
|
||||
className={cn(
|
||||
'flex items-center gap-2 px-4 py-2',
|
||||
'bg-white border border-[var(--color-border)] rounded-full',
|
||||
'bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-full',
|
||||
'text-sm text-[var(--color-text-secondary)]',
|
||||
'hover:bg-[var(--color-bg-tertiary)] hover:text-[var(--color-text-primary)]',
|
||||
'transition-all duration-150'
|
||||
|
||||
@ -63,7 +63,7 @@ export function ToolsDropdown({ tools, onToolToggle, onEnableAllToggle }: ToolsD
|
||||
{/* 下拉菜单 */}
|
||||
<div
|
||||
className={cn(
|
||||
'absolute bottom-full left-0 mb-2 min-w-[220px] bg-white border border-[var(--color-border)] rounded-xl shadow-lg p-2 z-50',
|
||||
'absolute bottom-full left-0 mb-2 min-w-[220px] bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-xl shadow-lg p-2 z-50',
|
||||
'transition-all duration-150',
|
||||
isOpen
|
||||
? 'opacity-100 visible translate-y-0'
|
||||
|
||||
@ -69,7 +69,7 @@ export function Sidebar({ user, isOpen = true }: SidebarProps) {
|
||||
{/* 侧边栏 */}
|
||||
<aside
|
||||
className={cn(
|
||||
'fixed top-0 left-0 bottom-0 z-50 bg-white border-r border-[var(--color-border-light)] flex flex-col transition-all duration-300 ease-in-out overflow-hidden',
|
||||
'fixed top-0 left-0 bottom-0 z-50 bg-[var(--color-bg-primary)] border-r border-[var(--color-border-light)] flex flex-col transition-all duration-300 ease-in-out overflow-hidden',
|
||||
isOpen ? 'w-[var(--sidebar-width)]' : 'w-0 border-r-0'
|
||||
)}
|
||||
>
|
||||
@ -146,10 +146,10 @@ export function Sidebar({ user, isOpen = true }: SidebarProps) {
|
||||
|
||||
{/* 下拉菜单 */}
|
||||
{menuOpen === conversation.conversationId && (
|
||||
<div className="absolute right-0 top-full mt-1 bg-white border border-[var(--color-border)] rounded-lg shadow-lg py-1 z-10 min-w-[120px]">
|
||||
<div className="absolute right-0 top-full mt-1 bg-[var(--color-bg-primary)] border border-[var(--color-border)] rounded-lg shadow-lg py-1 z-10 min-w-[120px]">
|
||||
<button
|
||||
onClick={(e) => handleDeleteConversation(conversation.conversationId, e)}
|
||||
className="w-full px-3 py-2 text-left text-sm text-red-600 hover:bg-red-50 flex items-center gap-2"
|
||||
className="w-full px-3 py-2 text-left text-sm text-red-500 hover:bg-[var(--color-bg-hover)] flex items-center gap-2"
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
删除
|
||||
|
||||
@ -168,7 +168,7 @@ export function UserMenu({ user }: UserMenuProps) {
|
||||
className={cn(
|
||||
'flex items-center gap-3 w-full px-4 py-3',
|
||||
'text-sm text-red-500',
|
||||
'hover:bg-red-50 transition-colors'
|
||||
'hover:bg-[var(--color-bg-hover)] transition-colors'
|
||||
)}
|
||||
role="menuitem"
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user