You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

search-card.tsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { MoreButton } from '@/components/more-button';
  2. import { RAGFlowAvatar } from '@/components/ragflow-avatar';
  3. import { Card, CardContent } from '@/components/ui/card';
  4. import { useNavigatePage } from '@/hooks/logic-hooks/navigate-hooks';
  5. import { formatDate } from '@/utils/date';
  6. import { ISearchAppProps } from './hooks';
  7. import { SearchDropdown } from './search-dropdown';
  8. interface IProps {
  9. data: ISearchAppProps;
  10. }
  11. export function SearchCard({ data }: IProps) {
  12. const { navigateToSearch } = useNavigatePage();
  13. return (
  14. <Card
  15. className="bg-bg-card border-colors-outline-neutral-standard"
  16. onClick={() => {
  17. navigateToSearch(data?.id);
  18. }}
  19. >
  20. <CardContent className="p-4 flex gap-2 items-start group h-full">
  21. <div className="flex justify-between mb-4">
  22. <RAGFlowAvatar
  23. className="w-[32px] h-[32px]"
  24. avatar={data.avatar}
  25. name={data.name}
  26. />
  27. </div>
  28. <div className="flex flex-col justify-between gap-1 flex-1 h-full">
  29. <section className="flex justify-between">
  30. <div className="text-[20px] font-bold w-80% leading-5">
  31. {data.name}
  32. </div>
  33. <SearchDropdown dataset={data}>
  34. <MoreButton></MoreButton>
  35. </SearchDropdown>
  36. </section>
  37. <section className="flex flex-col gap-1 mt-1">
  38. <div>{data.description}</div>
  39. <div>
  40. <p className="text-sm opacity-80">
  41. {formatDate(data.update_time)}
  42. </p>
  43. </div>
  44. </section>
  45. </div>
  46. </CardContent>
  47. </Card>
  48. );
  49. }