1
0

tool-frame.tsx 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use client';
  2. import { RotateCcw } from 'lucide-react';
  3. import type { ReactNode } from 'react';
  4. export function ToolFrame({
  5. title,
  6. description,
  7. onReset,
  8. children,
  9. }: {
  10. title: string;
  11. description?: string;
  12. onReset?: () => void;
  13. children: ReactNode;
  14. }) {
  15. return (
  16. <section
  17. role="group"
  18. aria-label={title}
  19. className="not-prose my-6 overflow-hidden rounded-2xl border bg-fd-card text-fd-foreground"
  20. >
  21. <header className="flex items-start justify-between gap-3 border-b px-4 py-3">
  22. <div>
  23. <h3 className="font-semibold">{title}</h3>
  24. {description ? (
  25. <p className="mt-0.5 text-sm text-fd-muted-foreground">{description}</p>
  26. ) : null}
  27. </div>
  28. {onReset ? (
  29. <button
  30. type="button"
  31. onClick={onReset}
  32. className="inline-flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground"
  33. >
  34. <RotateCcw className="size-3.5" aria-hidden />
  35. Reset
  36. </button>
  37. ) : null}
  38. </header>
  39. <div className="p-4">{children}</div>
  40. </section>
  41. );
  42. }