icons.tsx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * The few Lucide icons the panel uses (ZCode's icon set), as inline SVG so the bundle stays small.
  3. * Path data from Lucide (https://lucide.dev), ISC License, Copyright (c) Lucide Contributors 2022,
  4. * portions Copyright (c) Cole Bemis 2013-2022 (Feather, MIT). See THIRD_PARTY_NOTICES.txt.
  5. */
  6. const PATHS = {
  7. search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
  8. x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
  9. "chevron-up": '<path d="m18 15-6-6-6 6"/>',
  10. "chevron-down": '<path d="m6 9 6 6 6-6"/>',
  11. minus: '<path d="M5 12h14"/>',
  12. plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
  13. ellipsis:
  14. '<circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/>',
  15. "panel-left": '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/>',
  16. "file-text":
  17. '<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/>',
  18. copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
  19. "message-square-plus":
  20. '<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/><path d="M12 7v6"/><path d="M9 10h6"/>',
  21. "message-circle-question":
  22. '<path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"/><path d="M12 17h.01"/>',
  23. check: '<path d="M20 6 9 17l-5-5"/>',
  24. "rotate-cw":
  25. '<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/>',
  26. "arrow-down": '<path d="M12 5v14"/><path d="m19 12-7 7-7-7"/>',
  27. "arrow-up": '<path d="m5 12 7-7 7 7"/><path d="M12 19V5"/>',
  28. "folder-open":
  29. '<path d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"/>',
  30. "maximize-2":
  31. '<polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/>',
  32. } as const;
  33. export type IconName = keyof typeof PATHS;
  34. export function Icon({
  35. name,
  36. size = 14,
  37. className,
  38. }: {
  39. name: IconName;
  40. size?: 12 | 14 | 16 | 28;
  41. className?: string;
  42. }) {
  43. return (
  44. <svg
  45. className={`icon${className ? ` ${className}` : ""}`}
  46. width={size}
  47. height={size}
  48. viewBox="0 0 24 24"
  49. fill="none"
  50. stroke="currentColor"
  51. strokeWidth={2}
  52. strokeLinecap="round"
  53. strokeLinejoin="round"
  54. aria-hidden="true"
  55. // Static, trusted path data from this file only.
  56. dangerouslySetInnerHTML={{ __html: PATHS[name] }}
  57. />
  58. );
  59. }
  60. const TYPE_LABEL = { pdf: "PDF", docx: "W", xlsx: "X", pptx: "P" } as const;
  61. /** 16px coloured file-type square, used only where a list mixes document kinds. */
  62. export function FileType({ kind }: { kind: keyof typeof TYPE_LABEL }) {
  63. return (
  64. <span className={`filetype ${kind}`} aria-hidden="true">
  65. {TYPE_LABEL[kind]}
  66. </span>
  67. );
  68. }