diff --git a/src/components/SearchBar.jsx b/src/components/SearchBar.jsx new file mode 100644 index 0000000..b246261 --- /dev/null +++ b/src/components/SearchBar.jsx @@ -0,0 +1,42 @@ +export default function SearchBar({ searchTerm, onSearchChange, selectedDifficulty, onDifficultyChange }) { + const difficulties = ['all', 'beginner', 'intermediate', 'advanced'] + + return ( +
+ onSearchChange(e.target.value)} + style={{ + width: '100%', + padding: '10px 14px', + fontSize: '16px', + borderRadius: '8px', + border: '1px solid #ccc', + marginBottom: '12px', + boxSizing: 'border-box', + }} + /> +
+ {difficulties.map((level) => ( + + ))} +
+
+ ) +} \ No newline at end of file diff --git a/src/components/Storyboards.jsx b/src/components/Storyboards.jsx index 34ce24c..d58ebe7 100644 --- a/src/components/Storyboards.jsx +++ b/src/components/Storyboards.jsx @@ -1,4 +1,6 @@ +import { useState } from 'react' import { storyboards } from '../data/storyboards' +import SearchBar from './SearchBar' const difficultyColors = { beginner: { bg: 'rgba(123,92,240,0.15)', color: '#A78BFA' }, @@ -7,6 +9,18 @@ const difficultyColors = { } export default function Storyboards() { + const [searchTerm, setSearchTerm] = useState('') + const [selectedDifficulty, setSelectedDifficulty] = useState('all') + + const filtered = storyboards.filter((s) => { + const matchesSearch = + s.title.toLowerCase().includes(searchTerm.toLowerCase()) || + s.description.toLowerCase().includes(searchTerm.toLowerCase()) + const matchesDifficulty = + selectedDifficulty === 'all' || s.difficulty === selectedDifficulty + return matchesSearch && matchesDifficulty + }) + return (
@@ -18,59 +32,62 @@ export default function Storyboards() { Big ideas, made visual
- + View all concepts → -
- {storyboards.slice(0, 3).map((s) => ( -
{ - e.currentTarget.style.transform = 'translateY(-4px)' - e.currentTarget.style.borderColor = 'rgba(255,255,255,0.2)' - }} - onMouseLeave={e => { - e.currentTarget.style.transform = 'translateY(0)' - e.currentTarget.style.borderColor = 'rgba(255,255,255,0.08)' - }} - > + + + {filtered.length === 0 ? ( +
+ No results found. Try a different search or filter. +
+ ) : ( +
+ {filtered.map((s) => (
{ + e.currentTarget.style.transform = 'translateY(-4px)' + e.currentTarget.style.borderColor = 'rgba(255,255,255,0.2)' + }} + onMouseLeave={(e) => { + e.currentTarget.style.transform = 'translateY(0)' + e.currentTarget.style.borderColor = 'rgba(255,255,255,0.08)' + }} > - {s.emoji} -
- Visual Explainer -
-
-
-
- {s.title} +
+ {s.emoji} +
+ Visual Explainer +
-
- {s.description} +
+
+ {s.title} +
+
+ {s.description} +
+ + {s.difficulty} +
- - {s.difficulty} -
-
- ))} -
+ ))} +
+ )}
) -} +} \ No newline at end of file