2024-05-07 13:13:55 -04:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Clock4 } from 'lucide-react';
|
|
|
|
|
import { cn } from '~/utils';
|
|
|
|
|
|
|
|
|
|
export default function MentionItem({
|
|
|
|
|
name,
|
|
|
|
|
onClick,
|
|
|
|
|
index,
|
|
|
|
|
icon,
|
|
|
|
|
isActive,
|
|
|
|
|
description,
|
2024-08-08 10:02:30 -04:00
|
|
|
type = 'mention',
|
2024-05-07 13:13:55 -04:00
|
|
|
}: {
|
|
|
|
|
name: string;
|
|
|
|
|
onClick: () => void;
|
|
|
|
|
index: number;
|
2024-08-08 10:02:30 -04:00
|
|
|
type?: 'prompt' | 'mention' | 'add-convo';
|
2024-05-07 13:13:55 -04:00
|
|
|
icon?: React.ReactNode;
|
|
|
|
|
isActive?: boolean;
|
|
|
|
|
description?: string;
|
|
|
|
|
}) {
|
|
|
|
|
return (
|
2024-08-08 10:02:30 -04:00
|
|
|
<button tabIndex={index} onClick={onClick} id={`${type}-item-${index}`} className="w-full">
|
2024-05-07 13:13:55 -04:00
|
|
|
<div
|
|
|
|
|
className={cn(
|
2024-08-08 10:02:30 -04:00
|
|
|
'text-token-text-primary bg-token-main-surface-secondary group flex h-10 items-center gap-2 rounded-lg px-2 text-sm font-medium hover:bg-surface-secondary',
|
|
|
|
|
isActive ? 'bg-surface-active' : 'bg-transparent',
|
2024-05-07 13:13:55 -04:00
|
|
|
)}
|
|
|
|
|
>
|
2024-08-08 10:02:30 -04:00
|
|
|
<div className="flex h-5 w-5 flex-shrink-0 items-center justify-center">{icon}</div>
|
|
|
|
|
<div className="flex min-w-0 flex-grow items-center justify-between">
|
|
|
|
|
<div className="truncate">
|
|
|
|
|
<span className="font-medium">{name}</span>
|
2024-05-07 13:13:55 -04:00
|
|
|
{description ? (
|
2024-08-08 10:02:30 -04:00
|
|
|
<span className="text-token-text-tertiary ml-2 text-sm font-light">
|
2024-05-07 13:13:55 -04:00
|
|
|
{description}
|
|
|
|
|
</span>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
2024-08-08 10:02:30 -04:00
|
|
|
<Clock4 size={16} className="ml-2 flex-shrink-0" />
|
2024-05-07 13:13:55 -04:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-08-08 10:02:30 -04:00
|
|
|
</button>
|
2024-05-07 13:13:55 -04:00
|
|
|
);
|
|
|
|
|
}
|