-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
42 lines (36 loc) · 1.02 KB
/
App.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { useState } from 'react';
import './App.css';
import { CardComponent } from './CardComponent';
import { wildShapes } from './wildShapes';
function App() {
const [searchValue, setSearchValue] = useState('');
const handleSearch = (event: React.ChangeEvent<HTMLInputElement>) => {
setSearchValue(event.target.value);
};
const SearchBar = () => {
return (
<input
className="searchBar"
autoFocus
type="text"
placeholder="Buscar..."
value={searchValue}
onChange={handleSearch}
/>
);
};
const filteredWildShapes = wildShapes.filter((shape) => shape.name.toLowerCase().includes(searchValue.toLowerCase()));
return (
<div className="layout">
<h1>Formas Salvajes</h1>
<SearchBar />
{filteredWildShapes.length === 0 && <p>No se encontraron resultados</p>}
<div className="cards">
{filteredWildShapes.map((card) => (
<CardComponent card={card} />
))}
</div>
</div>
);
}
export default App;