File size: 732 Bytes
c3e8f3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use client';

import Link from 'next/link';
import { useParams } from 'next/navigation';
import { cn } from '@/lib/utils';

export interface ChatCardProps {
	id: string;
	title: string;
}

const ChatCard: React.FC<ChatCardProps> = ({ id, title }) => {
	const { chatId: chatIdFromParam } = useParams();
	return (
		<Link
			className={cn(
				'p-4 m-2 bg-white l:h-[250px] rounded-xl shadow-md flex items-center border border-transparent hover:border-gray-500 transition-all cursor-pointer',
				chatIdFromParam === id && 'border-gray-500',
			)}
			href={`/chat/${id}`}
		>
			<div className="overflow-hidden">
				<p className="text-sm font-medium text-black mb-1">{title}</p>
			</div>
		</Link>
	);
};

export default ChatCard;