SPB Git

spb/autoscholar

Public
1.0 KB · 41 lines tsx
1import { CopyButton } from "./CopyButton";2import { Tabs } from "./Tabs";34/** CitationPanel — BibTeX / RIS / plain text with copy and download. Content is computed server-side. */5export function CitationPanel({6  slug,7  bibtex,8  ris,9  plain,10}: {11  slug: string;12  bibtex: string;13  ris: string;14  plain: string;15}) {16  const panel = (text: string, ext: string, pre = true) => (17    <div>18      {pre ? (19        <pre className="surface-muted max-h-72 overflow-auto p-4 text-[12px] leading-relaxed">{text}</pre>20      ) : (21        <p className="surface-muted prose-paper p-4 text-sm">{text}</p>22      )}23      <div className="mt-2 flex gap-2">24        <CopyButton text={text} />25        <a className="btn btn-sm" href={`/research/${slug}/cite.${ext}`}>26          Download .{ext}27        </a>28      </div>29    </div>30  );31  return (32    <Tabs33      tabs={[34        { label: "BibTeX", content: panel(bibtex, "bib") },35        { label: "RIS", content: panel(ris, "ris") },36        { label: "Plain text", content: panel(plain, "txt", false) },37      ]}38    />39  );40}41
Files · main
Menu

Theme