import React, { useState } from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Badge } from '@/components/ui/badge'; import { Search } from 'lucide-react'; import BinarySearchTrick from '@/components/BinarySearchTrick'; interface Interactive { id: string; title: string; description: string; tags: string[]; component: React.ComponentType; } const interactives: Interactive[] = [{ id: 'binary-search-trick', title: 'Binary Search Magic Trick', description: 'Perform an amazing magic trick that reveals how binary numbers work. Think of a number and watch the magic happen!', tags: ['binary', 'magic', 'numbers', 'trick', 'data-structures'], component: BinarySearchTrick }]; const InteractiveGallery = () => { const [searchTerm, setSearchTerm] = useState(''); const [selectedInteractive, setSelectedInteractive] = useState(null); const filteredInteractives = interactives.filter(interactive => interactive.title.toLowerCase().includes(searchTerm.toLowerCase()) || interactive.description.toLowerCase().includes(searchTerm.toLowerCase()) || interactive.tags.some(tag => tag.toLowerCase().includes(searchTerm.toLowerCase()))); if (selectedInteractive) { const InteractiveComponent = selectedInteractive.component; return
; } return

Data Structures Interactives

Interactive tools and resources designed to connect theoretical concepts with practical applications in educational settings.

{/* Search bar */}
setSearchTerm(e.target.value)} className="pl-10" />
{/* Gallery */}
{filteredInteractives.map(interactive => setSelectedInteractive(interactive)}> {interactive.title} {interactive.description}
{interactive.tags.map(tag => {tag} )}
)}
{filteredInteractives.length === 0 &&

No interactives found matching your search.

}
; }; export default InteractiveGallery;