diff --git a/src/components/InteractiveGallery.tsx b/src/components/InteractiveGallery.tsx index d4bdb35..58a9d1c 100644 --- a/src/components/InteractiveGallery.tsx +++ b/src/components/InteractiveGallery.tsx @@ -5,7 +5,6 @@ import { Badge } from '@/components/ui/badge'; import { Search } from 'lucide-react'; import BinaryNumberGame from '@/components/BinaryNumberGame'; import BinarySearchTrick from '@/components/BinarySearchTrick'; - interface Interactive { id: string; title: string; @@ -13,56 +12,36 @@ interface Interactive { tags: string[]; component: React.ComponentType; } - -const interactives: Interactive[] = [ - { - id: 'binary-number-game', - title: 'Binary Number Representation', - description: 'Learn binary representation by expressing numbers as sums of powers of two. Toggle cards to match the target sum!', - tags: ['binary', 'math', 'numbers', 'representation', 'powers-of-two'], - component: BinaryNumberGame, - }, - { - 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 interactives: Interactive[] = [{ + id: 'binary-number-game', + title: 'Binary Number Representation', + description: 'Learn binary representation by expressing numbers as sums of powers of two. Toggle cards to match the target sum!', + tags: ['binary', 'math', 'numbers', 'representation', 'powers-of-two'], + component: BinaryNumberGame +}, { + 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())) - ); - + 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
- -

{selectedInteractive.title}

+ +
-
- ); +
; } - - return ( -
+ return

School Connect Interactives

@@ -73,22 +52,12 @@ const InteractiveGallery = () => { {/* Search bar */}

- setSearchTerm(e.target.value)} - className="pl-10" - /> + setSearchTerm(e.target.value)} className="pl-10" />
{/* Gallery */}
- {filteredInteractives.map((interactive) => ( - setSelectedInteractive(interactive)} - > + {filteredInteractives.map(interactive => setSelectedInteractive(interactive)}> {interactive.title} @@ -97,24 +66,17 @@ const InteractiveGallery = () => {
- {interactive.tags.map((tag) => ( - + {interactive.tags.map(tag => {tag} - - ))} + )}
-
- ))} +
)}
- {filteredInteractives.length === 0 && ( -
+ {filteredInteractives.length === 0 &&

No interactives found matching your search.

-
- )} -
- ); +
} +
; }; - export default InteractiveGallery; \ No newline at end of file diff --git a/src/pages/theme-pages/DataStructures.tsx b/src/pages/theme-pages/DataStructures.tsx index 5dd1c09..e6a89a1 100644 --- a/src/pages/theme-pages/DataStructures.tsx +++ b/src/pages/theme-pages/DataStructures.tsx @@ -1,24 +1,15 @@ import Layout from "@/components/Layout"; import InteractiveGallery from "@/components/InteractiveGallery"; - const DataStructures = () => { - return ( - + return
-

- Data Structures -

-

- Master fundamental and advanced data structures through interactive manipulation and visualization. - Explore trees, graphs, heaps, hash tables, and their real-world applications. -

+ +
-
- ); +
; }; - export default DataStructures; \ No newline at end of file