import { Button, Input, ScrollArea, Tabs, TabsContent, TabsList, TabsTrigger, } from "../ui"; import * as LucideIcons from "lucide-react"; import { useState } from "react"; import { emojiData } from "./emoji-data"; import { cn } from "~/lib/utils"; interface IconPickerProps { onSelectIcon?: (icon: string, color: string) => void; onSelectEmoji?: (emoji: string) => void; onRemove?: () => void; onUploadIcon?: (file: File) => void; } const colorOptions = [ "#000", "oklch(66% 0.1835 292)", "oklch(66% 0.1835 169)", "oklch(66% 0.1835 30)", "oklch(66% 0.1835 308)", "oklch(66% 0.1835 339)", "oklch(66% 0.1835 277)", "oklch(66% 0.1835 30)", "oklch(66% 0.1835 71)", "oklch(66% 0.1835 228)", ]; export function IconPicker({ onSelectIcon, onSelectEmoji, onRemove, }: IconPickerProps) { const [activeTab, setActiveTab] = useState("icons"); const [iconSearch, setIconSearch] = useState(""); const [emojiSearch, setEmojiSearch] = useState(""); const [selectedColor, setSelectedColor] = useState(colorOptions[0]); // Filter icons based on search const filteredIcons = Object.keys(LucideIcons) .filter( (iconName) => iconName !== "createLucideIcon" && iconName.toLowerCase().includes(iconSearch.toLowerCase()), ) .slice(0, 100); // Limit to 120 icons for performance // Filter emojis based on search const filteredEmojis = emojiSearch ? emojiData.filter((emoji) => emoji.name.toLowerCase().includes(emojiSearch.toLowerCase()), ) : emojiData; return (
Icons Emojis {/* Icons Tab */}
{colorOptions.map((color, index) => (
setIconSearch(e.target.value)} />
{filteredIcons.map((iconName) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const IconComponent = (LucideIcons as any)[iconName]; return ( ); })}
{/* Emojis Tab */}
setEmojiSearch(e.target.value)} />
{filteredEmojis.map((emoji) => ( ))}
); }