Skip to content

Commit

Permalink
feat : ChatLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-Dongwook committed Oct 26, 2024
1 parent 962afb4 commit 5ca16a1
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion src/components/organisms/ChatLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,40 @@
'use client';
import React, { useState } from 'react';

import React from 'react';
import { ChatInput } from '@/components/molecules/ChatInput';
import { MessageBubble } from '@/components/molecules/MessageBubble';
import type { ChatMessage } from '@/types';

interface ChatLayoutProps {
messages: ChatMessage[];
onSendMessage: (message: string) => void;
isSending: boolean;
}

export const ChatLayout: React.FC<ChatLayoutProps> = ({
messages,
onSendMessage,
isSending,
}) => {
return (
<div className="flex flex-col h-full">
<div className="flex-1 overflow-y-auto p-4 space-y-2">
{messages.map((msg) => (
<MessageBubble
message={msg.message}
sender={msg.sender}
timestamp={msg.createdAt}
/>
))}
</div>

<div className="p-2 border-t">
<ChatInput
onSendMessage={onSendMessage}
placeholder="Type your message..."
/>
{isSending && <p className="text-sm text-gray-500">Sending...</p>}
</div>
</div>
);
};

0 comments on commit 5ca16a1

Please sign in to comment.