Download src/components/Icon.tsx from AnesKAM/gen: direct link, hf CLI and curl.
- Browser
- Download file 6.17 kB
-
https://huggingface.co/spaces/AnesKAM/gen/resolve/main/src/components/Icon.tsx
- Command line
-
hf download hf://spaces/AnesKAM/gen/src/components/Icon.tsx
-
curl -L -o Icon.tsx https://huggingface.co/spaces/AnesKAM/gen/resolve/main/src/components/Icon.tsx
6.17 kB
| import type { ReactNode } from "react"; | |
| import { cn } from "@/lib/utils"; | |
| const PATHS: Record<string, ReactNode> = { | |
| search: ( | |
| <> | |
| <circle cx="11" cy="11" r="7" /> | |
| <path d="M21 21l-4.35-4.35" /> | |
| </> | |
| ), | |
| image: ( | |
| <> | |
| <rect x="3" y="3" width="18" height="18" rx="2" /> | |
| <circle cx="9" cy="9" r="2" /> | |
| <path d="M21 15l-5-5L5 21" /> | |
| </> | |
| ), | |
| news: ( | |
| <> | |
| <path d="M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0V9" /> | |
| <path d="M18 14h-8" /> | |
| <path d="M15 18h-5" /> | |
| <path d="M10 6h8v4h-8V6Z" /> | |
| </> | |
| ), | |
| video: ( | |
| <> | |
| <rect x="2" y="5" width="20" height="14" rx="3" /> | |
| <path d="M10 9.5l5 2.5-5 2.5v-5z" fill="currentColor" stroke="none" /> | |
| </> | |
| ), | |
| play: <path d="M8 5v14l11-7z" fill="currentColor" stroke="none" />, | |
| bookmark: <path d="M19 21l-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" />, | |
| "bookmark-fill": ( | |
| <path d="M19 21l-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z" fill="currentColor" stroke="none" /> | |
| ), | |
| grid: ( | |
| <> | |
| <rect x="3" y="3" width="7" height="7" rx="1.5" /> | |
| <rect x="14" y="3" width="7" height="7" rx="1.5" /> | |
| <rect x="3" y="14" width="7" height="7" rx="1.5" /> | |
| <rect x="14" y="14" width="7" height="7" rx="1.5" /> | |
| </> | |
| ), | |
| clock: ( | |
| <> | |
| <circle cx="12" cy="12" r="9" /> | |
| <path d="M12 7v5l3.5 2" /> | |
| </> | |
| ), | |
| folder: <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2v11z" />, | |
| settings: ( | |
| <> | |
| <path d="M21 4h-7" /> | |
| <path d="M10 4H3" /> | |
| <path d="M21 12h-9" /> | |
| <path d="M8 12H3" /> | |
| <path d="M21 20h-5" /> | |
| <path d="M12 20H3" /> | |
| <path d="M14 2v4" /> | |
| <path d="M8 10v4" /> | |
| <path d="M16 18v4" /> | |
| </> | |
| ), | |
| logout: ( | |
| <> | |
| <path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /> | |
| <path d="M16 17l5-5-5-5" /> | |
| <path d="M21 12H9" /> | |
| </> | |
| ), | |
| menu: ( | |
| <> | |
| <path d="M4 6h16" /> | |
| <path d="M4 12h16" /> | |
| <path d="M4 18h16" /> | |
| </> | |
| ), | |
| x: <path d="M18 6L6 18M6 6l12 12" />, | |
| plus: <path d="M12 5v14M5 12h14" />, | |
| trash: ( | |
| <> | |
| <path d="M3 6h18" /> | |
| <path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" /> | |
| <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" /> | |
| <path d="M10 11v6M14 11v6" /> | |
| </> | |
| ), | |
| edit: <path d="M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z" />, | |
| external: ( | |
| <> | |
| <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" /> | |
| <path d="M15 3h6v6" /> | |
| <path d="M10 14L21 3" /> | |
| </> | |
| ), | |
| sparkles: ( | |
| <> | |
| <path d="M12 3l1.9 5.7a2 2 0 0 0 1.3 1.3L21 12l-5.8 1.9a2 2 0 0 0-1.3 1.3L12 21l-1.9-5.8a2 2 0 0 0-1.3-1.3L3 12l5.8-1.9a2 2 0 0 0 1.3-1.3L12 3z" /> | |
| </> | |
| ), | |
| home: ( | |
| <> | |
| <path d="M3 10.5L12 3l9 7.5" /> | |
| <path d="M5 9.5V21h14V9.5" /> | |
| </> | |
| ), | |
| refresh: ( | |
| <> | |
| <path d="M21 12a9 9 0 1 1-2.64-6.36" /> | |
| <path d="M21 3v6h-6" /> | |
| </> | |
| ), | |
| check: <path d="M20 6L9 17l-5-5" />, | |
| alert: ( | |
| <> | |
| <circle cx="12" cy="12" r="9" /> | |
| <path d="M12 8v4" /> | |
| <path d="M12 16h.01" /> | |
| </> | |
| ), | |
| user: ( | |
| <> | |
| <circle cx="12" cy="8" r="4" /> | |
| <path d="M4 21c0-4 3.6-6.5 8-6.5s8 2.5 8 6.5" /> | |
| </> | |
| ), | |
| mail: ( | |
| <> | |
| <rect x="2" y="4" width="20" height="16" rx="2" /> | |
| <path d="M22 7l-10 6L2 7" /> | |
| </> | |
| ), | |
| lock: ( | |
| <> | |
| <rect x="4" y="11" width="16" height="10" rx="2" /> | |
| <path d="M8 11V7a4 4 0 0 1 8 0v4" /> | |
| </> | |
| ), | |
| globe: ( | |
| <> | |
| <circle cx="12" cy="12" r="9" /> | |
| <path d="M3 12h18" /> | |
| <path d="M12 3c2.5 2.6 4 5.6 4 9s-1.5 6.4-4 9c-2.5-2.6-4-5.6-4-9s1.5-6.4 4-9z" /> | |
| </> | |
| ), | |
| "chevron-down": <path d="M6 9l6 6 6-6" />, | |
| "chevron-right": <path d="M9 6l6 6-6 6" />, | |
| "arrow-up": <path d="M12 19V5M5 12l7-7 7 7" />, | |
| eye: ( | |
| <> | |
| <path d="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z" /> | |
| <circle cx="12" cy="12" r="3" /> | |
| </> | |
| ), | |
| "eye-off": ( | |
| <> | |
| <path d="M3 3l18 18" /> | |
| <path d="M10.6 5.1A10.6 10.6 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.1" /> | |
| <path d="M6.6 6.6A17.3 17.3 0 0 0 2 12s3.6 7 10 7a10.4 10.4 0 0 0 5.4-1.6" /> | |
| <path d="M9.9 9.9a3 3 0 0 0 4.2 4.2" /> | |
| </> | |
| ), | |
| link: ( | |
| <> | |
| <path d="M10 13a5 5 0 0 0 7.07 0l3-3a5 5 0 0 0-7.07-7.07l-1.5 1.5" /> | |
| <path d="M14 11a5 5 0 0 0-7.07 0l-3 3a5 5 0 0 0 7.07 7.07l1.5-1.5" /> | |
| </> | |
| ), | |
| history: ( | |
| <> | |
| <path d="M3 12a9 9 0 1 0 3-6.7L3 8" /> | |
| <path d="M3 3v5h5" /> | |
| <path d="M12 7v5l3.5 2" /> | |
| </> | |
| ), | |
| save: <path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />, | |
| layers: ( | |
| <> | |
| <path d="M12 2l10 5.5-10 5.5L2 7.5 12 2z" /> | |
| <path d="M2 12.5l10 5.5 10-5.5" /> | |
| <path d="M2 17.5L12 23l10-5.5" /> | |
| </> | |
| ), | |
| sun: ( | |
| <> | |
| <circle cx="12" cy="12" r="4" /> | |
| <path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" /> | |
| </> | |
| ), | |
| moon: <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />, | |
| message: ( | |
| <path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z" /> | |
| ), | |
| shield: <path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />, | |
| "arrow-right": <path d="M5 12h14M13 5l7 7-7 7" />, | |
| sliders: ( | |
| <> | |
| <line x1="4" y1="7" x2="20" y2="7" /> | |
| <line x1="4" y1="17" x2="20" y2="17" /> | |
| <circle cx="9" cy="7" r="2" /> | |
| <circle cx="15" cy="17" r="2" /> | |
| </> | |
| ), | |
| }; | |
| export default function Icon({ | |
| name, | |
| className, | |
| strokeWidth = 2, | |
| }: { | |
| name: keyof typeof PATHS | string; | |
| className?: string; | |
| strokeWidth?: number; | |
| }) { | |
| return ( | |
| <svg | |
| viewBox="0 0 24 24" | |
| fill="none" | |
| stroke="currentColor" | |
| strokeWidth={strokeWidth} | |
| strokeLinecap="round" | |
| strokeLinejoin="round" | |
| className={cn("h-5 w-5 shrink-0", className)} | |
| aria-hidden="true" | |
| > | |
| {PATHS[name] ?? PATHS.search} | |
| </svg> | |
| ); | |
| } | |