Skip to content

Commit fba3e6d

Browse files
authored
Merge pull request #15 from karsh0/main
Fixed Chatbot ui
2 parents 7d812d9 + fe3ef69 commit fba3e6d

1 file changed

Lines changed: 29 additions & 31 deletions

File tree

components/chatbot.tsx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,38 +83,39 @@ const Chatbot = () => {
8383
</button>
8484
)}
8585

86-
{/* Chatbox */}
8786
{isChatOpen && (
88-
<div className="fixed bottom-0 right-0 w-80 h-96 bg-black text-white shadow-lg rounded-tl-lg z-40">
89-
<div className="flex justify-between items-center bg-black text-white p-3 rounded-tl-lg rounded-tr-lg">
90-
<span>bot</span>
91-
<button
92-
onClick={toggleChat}
93-
className="p-1 bg-transparent text-white rounded-full"
94-
>
95-
<X className="h-5 w-5" />
96-
</button>
97-
</div>
98-
<div className="p-4 overflow-y-auto h-[calc(100%-170px)]">
99-
<div className="flex flex-col space-y-2">
100-
{chatHistory.map((msg, index) => (
101-
<div
102-
key={index}
103-
className={`flex ${
104-
msg.sender === "user" ? "justify-end" : "justify-start"
105-
}`}
106-
>
87+
<div className="fixed bottom-0 right-0 w-80 h-96 bg-black text-white shadow-lg rounded-tl-lg z-40 border flex flex-col justify-between">
88+
<div>
89+
<div className="flex justify-between items-center bg-black text-white p-3 rounded-tl-lg rounded-tr-lg">
90+
<span>Chatbot</span>
91+
<button
92+
onClick={toggleChat}
93+
className="p-1 bg-transparent text-white rounded-full"
94+
>
95+
<X className="h-5 w-5" />
96+
</button>
97+
</div>
98+
<div className="p-4 overflow-y-auto max-h-64">
99+
<div className="flex flex-col justify-start space-y-2">
100+
{chatHistory.map((msg, index) => (
107101
<div
108-
className={`p-2 rounded-lg max-w-xs ${
109-
msg.sender === "user"
110-
? "bg-white text-black"
111-
: "bg-gray-600 text-white"
102+
key={index}
103+
className={`flex ${
104+
msg.sender === "user" ? "justify-end" : "justify-start"
112105
}`}
113106
>
114-
{msg.text}
107+
<div
108+
className={`p-2 rounded-lg max-w-xs ${
109+
msg.sender === "user"
110+
? "bg-white text-black"
111+
: "bg-gray-600 text-white"
112+
}`}
113+
>
114+
{msg.text}
115+
</div>
115116
</div>
116-
</div>
117-
))}
117+
))}
118+
</div>
118119
</div>
119120
</div>
120121
<div className="p-3 bg-gray-700 flex items-center">
@@ -126,15 +127,12 @@ const Chatbot = () => {
126127
onChange={(e) => setMessage(e.target.value)}
127128
/>
128129
<button
129-
className="ml-2 p-2 bg-black text-white rounded-full"
130+
className="ml-2 p-2 bg-black text-white rounded-xl"
130131
onClick={sendMessage}
131132
>
132133
Send
133134
</button>
134135
</div>
135-
<div className="p-3 bg-gray-800 flex items-center">
136-
137-
</div>
138136
</div>
139137
)}
140138
</div>

0 commit comments

Comments
 (0)