mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
Pass in actual code snippet to codeblock
This commit is contained in:
parent
fce25841cd
commit
898b329fc9
1 changed files with 11 additions and 7 deletions
|
|
@ -165,14 +165,18 @@ const FileMatch = ({
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<div className="bg-cyan-200 primary-foreground px-2">
|
<div className="bg-cyan-200 primary-foreground px-2">
|
||||||
<span className="font-medium">{match.Repo}</span> · {match.FileName}
|
<span>{match.Repo} · {match.FileName}</span>
|
||||||
</div>
|
|
||||||
{/* Code block */}
|
|
||||||
<div className="font-mono px-4">
|
|
||||||
<p>{"1: if (my_ptr->asdf) {"}</p>
|
|
||||||
<p>{"2: doSomething()"}</p>
|
|
||||||
<p>{"3: }"}</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
{match.Matches.map((match, index) => {
|
||||||
|
const fragment = match.Fragments[0];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={index} className="font-mono px-4 py-0.5 text-sm">
|
||||||
|
<p>{match.LineNum}: {fragment.Pre}<span className="font-bold">{fragment.Match}</span>{fragment.Post}</p>
|
||||||
|
<Separator />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue