'use client'; import * as React from 'react'; import { Input } from '@/components/ui/Input'; import { Card } from '@/components/ui/Card'; import { Search } from 'lucide-react'; import { cn } from '@/lib/utils/cn'; import type { FigletFont } from '@/types/figlet'; export interface FontSelectorProps { fonts: FigletFont[]; selectedFont: string; onSelectFont: (fontName: string) => void; className?: string; } export function FontSelector({ fonts, selectedFont, onSelectFont, className }: FontSelectorProps) { const [searchQuery, setSearchQuery] = React.useState(''); const filteredFonts = React.useMemo(() => { if (!searchQuery) return fonts; const query = searchQuery.toLowerCase(); return fonts.filter(font => font.name.toLowerCase().includes(query) ); }, [fonts, searchQuery]); return (

Select Font

setSearchQuery(e.target.value)} className="pl-9" />
{filteredFonts.length === 0 ? (
No fonts found
) : ( filteredFonts.map((font) => ( )) )}
{filteredFonts.length} font{filteredFonts.length !== 1 ? 's' : ''} available
); }