11"use client"
22import React , { useState , useRef , useEffect } from "react"
3- import { IconPlus , IconLoader , IconSend } from "@tabler/icons-react"
3+ import { IconLoader , IconSend } from "@tabler/icons-react"
44import { cn } from "@utils/cn"
5+ import { BorderTrail } from "@components/ui/border-trail"
56import { TextLoop } from "@components/ui/TextLoop"
67import toast from "react-hot-toast"
78
@@ -14,7 +15,7 @@ const CreateTaskInput = ({ onTaskAdded, prompt, setPrompt }) => {
1415 if ( textarea ) {
1516 textarea . style . height = "auto"
1617 const scrollHeight = textarea . scrollHeight
17- textarea . style . height = `${ scrollHeight > 120 ? 120 : scrollHeight } px`
18+ textarea . style . height = `${ Math . min ( Math . max ( scrollHeight , 20 ) , 100 ) } px`
1819 }
1920 } , [ prompt ] )
2021
@@ -44,50 +45,59 @@ const CreateTaskInput = ({ onTaskAdded, prompt, setPrompt }) => {
4445 }
4546
4647 return (
47- < div className = "p-4 flex-shrink-0 bg-brand-black " >
48+ < div className = "p-4 flex-shrink-0 bg-transparent " >
4849 < div
4950 className = { cn (
50- "relative flex items-end bg-brand-gray rounded-xl p-1 transition-all border border-transparent focus-within:border-brand-orange "
51+ "relative flex items-end bg-brand-black rounded-full p-1 transition-all overflow-hidden "
5152 ) }
5253 >
53- < textarea
54- ref = { textareaRef }
55- value = { prompt }
56- onChange = { ( e ) => setPrompt ( e . target . value ) }
57- onKeyDown = { ( e ) => {
58- if ( e . key === "Enter" && ! e . shiftKey ) {
59- e . preventDefault ( )
60- handleAddTask ( )
61- }
62- } }
63- placeholder = " "
64- className = "w-full bg-transparent text-white placeholder-transparent resize-none focus:ring-0 focus:outline-none p-2 custom-scrollbar text-sm"
65- rows = { 1 }
66- style = { { maxHeight : "120px" } }
67- />
68- { ! prompt && (
69- < div className = "absolute top-1/2 left-3 -translate-y-1/2 text-neutral-500 pointer-events-none" >
70- < TextLoop className = "text-sm" >
71- < span > Create a task...</ span >
72- < span > Summarize my unread emails from today</ span >
73- < span >
74- Draft a follow-up to the project proposal
75- </ span >
76- < span > Schedule a meeting with the design team</ span >
77- </ TextLoop >
78- </ div >
79- ) }
80- < button
81- onClick = { handleAddTask }
82- disabled = { isSaving || ! prompt . trim ( ) }
83- className = "p-2.5 bg-brand-orange rounded-lg text-brand-black disabled:opacity-50 hover:bg-opacity-80 transition-colors"
54+ < BorderTrail size = { 100 } className = "bg-brand-orange px-4" />
55+ < div
56+ className = { cn (
57+ "relative flex gap-2 items-end bg-transparent p-1 transition-all w-full"
58+ ) }
8459 >
85- { isSaving ? (
86- < IconLoader size = { 18 } className = "animate-spin" />
87- ) : (
88- < IconSend size = { 18 } />
60+ < textarea
61+ ref = { textareaRef }
62+ value = { prompt }
63+ onChange = { ( e ) => setPrompt ( e . target . value ) }
64+ onKeyDown = { ( e ) => {
65+ if ( e . key === "Enter" && ! e . shiftKey ) {
66+ e . preventDefault ( )
67+ handleAddTask ( )
68+ }
69+ } }
70+ placeholder = " "
71+ className = "w-full rounded-l-full bg-transparent text-white placeholder-transparent border-1 border-brand-orange focus:ring-0 focus:ring-brand-black text-sm z-10 overflow-y-auto"
72+ />
73+ { ! prompt && (
74+ < div className = "absolute top-1/2 left-4 -translate-y-1/2 text-neutral-500 pointer-events-none z-0" >
75+ < TextLoop className = "text-sm px-2" >
76+ < span > Create a task...</ span >
77+ < span >
78+ Summarize my unread emails from today
79+ </ span >
80+ < span >
81+ Draft a follow-up to the project proposal
82+ </ span >
83+ < span >
84+ Schedule a meeting with the design team
85+ </ span >
86+ </ TextLoop >
87+ </ div >
8988 ) }
90- </ button >
89+ < button
90+ onClick = { handleAddTask }
91+ disabled = { isSaving || ! prompt . trim ( ) }
92+ className = "p-3 bg-brand-orange rounded-r-full h-12 text-brand-black disabled:opacity-50 hover:bg-opacity-80 transition-colors z-10 flex-shrink-0"
93+ >
94+ { isSaving ? (
95+ < IconLoader size = { 18 } className = "animate-spin" />
96+ ) : (
97+ < IconSend size = { 18 } />
98+ ) }
99+ </ button >
100+ </ div >
91101 </ div >
92102 </ div >
93103 )
0 commit comments