aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/components/SearchResults.tsx
blob: 0445d0b415654e59ace0953b8504d9c09dbcb936 (plain) (blame)
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
31
32
33
34
35
36
37
38
'use client'

import React from 'react';
import { Card, CardContent } from './ui/card';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm'

function SearchResults({
  aiResponse,
  sources,
}: {
  aiResponse: string;
  sources: string[];
}) {
  return (
    <div
      style={{
        backgroundImage: `linear-gradient(to right, #E5D9F2, #CDC1FF)`,
      }}
      className="w-full max-w-2xl mx-auto px-4 py-6 space-y-6 border mt-4 rounded-xl"
    >
      <div className="text-start">
        <div className="text-xl text-black">
          <Markdown remarkPlugins={[remarkGfm]}>{aiResponse.replace('</s>', '')}</Markdown>
        </div>
      </div>
      <div className="grid gap-6">
        {sources.map((value, index) => (
          <Card key={index}>
            <CardContent className="space-y-2">{value}</CardContent>
          </Card>
        ))}
      </div>
    </div>
  );
}

export default SearchResults;