sources-custom.tsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Derived from vercel/ai-elements (skills/ai-elements/scripts/sources-custom.tsx).
  3. * Copyright 2023 Vercel, Inc. Licensed under Apache-2.0.
  4. * Modified by ZCode: local integration, formatting and adaptations.
  5. * See THIRD-PARTY-NOTICES.md in the repository root for license and provenance.
  6. */
  7. "use client";
  8. import { Source, Sources, SourcesContent, SourcesTrigger } from "@/components/ai-elements/sources";
  9. import { ChevronDownIcon, ExternalLinkIcon } from "lucide-react";
  10. const sources = [
  11. { href: "https://stripe.com/docs/api", title: "Stripe API Documentation" },
  12. { href: "https://docs.github.com/en/rest", title: "GitHub REST API" },
  13. {
  14. href: "https://docs.aws.amazon.com/sdk-for-javascript/",
  15. title: "AWS SDK for JavaScript",
  16. },
  17. ];
  18. const Example = () => (
  19. <div style={{ height: "110px" }}>
  20. <Sources>
  21. <SourcesTrigger count={sources.length}>
  22. <p className="font-medium">Using {sources.length} citations</p>
  23. <ChevronDownIcon className="size-4" />
  24. </SourcesTrigger>
  25. <SourcesContent>
  26. {sources.map((source) => (
  27. <Source href={source.href} key={source.href}>
  28. {source.title}
  29. <ExternalLinkIcon className="size-4" />
  30. </Source>
  31. ))}
  32. </SourcesContent>
  33. </Sources>
  34. </div>
  35. );
  36. export default Example;