Spaces:
Running

axeronis commited on
Commit
d9f3520
·
1 Parent(s): ca630f9

style: refined message input - removed inner bg block and smoothed send glow

Browse files
frontend/components/ChatWindow/MessageInput.tsx CHANGED
@@ -3,6 +3,7 @@
3
  import { cn } from '@/lib/utils'
4
  import { Loader2, Paperclip, Send, Mic, X, Play, Pause } from 'lucide-react'
5
  import { useRef, useState } from 'react'
 
6
 
7
  interface MessageInputProps {
8
  value: string
@@ -132,7 +133,7 @@ export function MessageInput({
132
  }
133
 
134
  return (
135
- <div className="px-3 pb-3 pt-2 bg-black/60 backdrop-blur-xl flex-shrink-0 md:relative fixed bottom-14 md:bottom-auto left-0 right-0 z-30">
136
  <div className="max-w-4xl mx-auto relative">
137
  {/* File Preview */}
138
  {selectedFile && (
@@ -193,7 +194,7 @@ export function MessageInput({
193
 
194
  <form
195
  onSubmit={handleSubmit}
196
- className="flex items-center gap-2 bg-white/5 backdrop-blur-md p-1.5 rounded-2xl border border-white/5 focus-within:ring-1 focus-within:ring-white/10 transition-all shadow-lg"
197
  >
198
  <input
199
  type="file"
@@ -203,13 +204,13 @@ export function MessageInput({
203
  accept="image/*,.pdf,.txt,.doc,.docx"
204
  />
205
 
206
- <div className="flex items-center gap-1 pl-1">
207
  <button
208
  type="button"
209
  onClick={() => fileInputRef.current?.click()}
210
  className={cn(
211
- "p-2 rounded-xl transition-all active:scale-90",
212
- selectedFile ? "text-indigo-400 bg-indigo-500/10" : "text-slate-400 hover:text-white"
213
  )}
214
  >
215
  <Paperclip className="w-5 h-5" />
@@ -219,8 +220,8 @@ export function MessageInput({
219
  type="button"
220
  onClick={startRecording}
221
  className={cn(
222
- "p-2 rounded-xl transition-all active:scale-90",
223
- isRecording ? "text-red-500 bg-red-500/10 animate-pulse" : "text-slate-400 hover:text-white"
224
  )}
225
  disabled={!!selectedFile}
226
  >
@@ -233,37 +234,31 @@ export function MessageInput({
233
  onChange={(e) => onChange(e.target.value)}
234
  onKeyDown={handleKeyDown}
235
  placeholder="Сообщение..."
236
- className="flex-1 bg-transparent border-none focus:ring-0 resize-none max-h-32 py-2.5 px-3 text-[16px] leading-tight text-white placeholder:text-slate-500"
237
  rows={1}
238
- style={{ minHeight: '44px' }}
239
  disabled={disabled || isRecording}
240
  />
241
 
242
-
243
  <button
244
  type="submit"
245
  disabled={(!value.trim() && !selectedFile) || isSending || disabled}
246
  className={cn(
247
- "p-2.5 rounded-xl transition-all duration-300 group relative",
248
  ((value.trim() || selectedFile) && !isSending && !disabled)
249
  ? "text-white"
250
- : "text-slate-600 opacity-50 grayscale"
251
  )}
252
  >
253
  {isSending ? (
254
  <Loader2 className="w-5 h-5 animate-spin" />
255
  ) : (
256
- <>
257
- <Send className={cn(
258
- "w-5 h-5 transition-all duration-300",
259
- ((value.trim() || selectedFile) && !isSending && !disabled)
260
- ? "filter drop-shadow-[0_0_8px_rgba(99,102,241,0.8)] scale-110"
261
- : ""
262
- )} />
263
- {((value.trim() || selectedFile) && !isSending && !disabled) && (
264
- <div className="absolute inset-0 bg-indigo-500/20 blur-xl rounded-full -z-10 animate-pulse" />
265
- )}
266
- </>
267
  )}
268
  </button>
269
  </form>
 
3
  import { cn } from '@/lib/utils'
4
  import { Loader2, Paperclip, Send, Mic, X, Play, Pause } from 'lucide-react'
5
  import { useRef, useState } from 'react'
6
+ import { motion, AnimatePresence } from 'framer-motion'
7
 
8
  interface MessageInputProps {
9
  value: string
 
133
  }
134
 
135
  return (
136
+ <div className="px-3 pb-3 pt-2 bg-black/40 backdrop-blur-xl flex-shrink-0 md:relative fixed bottom-14 md:bottom-auto left-0 right-0 z-30">
137
  <div className="max-w-4xl mx-auto relative">
138
  {/* File Preview */}
139
  {selectedFile && (
 
194
 
195
  <form
196
  onSubmit={handleSubmit}
197
+ className="flex items-center gap-2 px-1.5 py-1 transition-all"
198
  >
199
  <input
200
  type="file"
 
204
  accept="image/*,.pdf,.txt,.doc,.docx"
205
  />
206
 
207
+ <div className="flex items-center gap-0.5">
208
  <button
209
  type="button"
210
  onClick={() => fileInputRef.current?.click()}
211
  className={cn(
212
+ "p-2 rounded-full transition-all active:scale-90",
213
+ selectedFile ? "text-indigo-400 bg-indigo-500/10" : "text-slate-400/80 hover:text-white"
214
  )}
215
  >
216
  <Paperclip className="w-5 h-5" />
 
220
  type="button"
221
  onClick={startRecording}
222
  className={cn(
223
+ "p-2 rounded-full transition-all active:scale-90",
224
+ isRecording ? "text-red-500 bg-red-500/10 animate-pulse" : "text-slate-400/80 hover:text-white"
225
  )}
226
  disabled={!!selectedFile}
227
  >
 
234
  onChange={(e) => onChange(e.target.value)}
235
  onKeyDown={handleKeyDown}
236
  placeholder="Сообщение..."
237
+ className="flex-1 bg-white/5 border border-white/5 rounded-2xl focus:ring-1 focus:ring-white/10 resize-none max-h-32 py-3 px-4 text-[16px] leading-tight text-white placeholder:text-slate-500/60 overflow-y-auto transition-all"
238
  rows={1}
239
+ style={{ minHeight: '48px' }}
240
  disabled={disabled || isRecording}
241
  />
242
 
 
243
  <button
244
  type="submit"
245
  disabled={(!value.trim() && !selectedFile) || isSending || disabled}
246
  className={cn(
247
+ "p-2.5 rounded-xl transition-all duration-500 relative flex items-center justify-center",
248
  ((value.trim() || selectedFile) && !isSending && !disabled)
249
  ? "text-white"
250
+ : "text-slate-600/50 opacity-50 grayscale"
251
  )}
252
  >
253
  {isSending ? (
254
  <Loader2 className="w-5 h-5 animate-spin" />
255
  ) : (
256
+ <Send className={cn(
257
+ "w-5 h-5 transition-all duration-500",
258
+ ((value.trim() || selectedFile) && !isSending && !disabled)
259
+ ? "scale-110 [filter:drop-shadow(0_0_8px_rgba(99,102,241,0.8))]"
260
+ : "scale-100"
261
+ )} />
 
 
 
 
 
262
  )}
263
  </button>
264
  </form>