добавил поиск по названию и вернул филтрацию
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
|
||||
import React from "react";
|
||||
import BookForm from "./BookForm";
|
||||
import BookList from "./BookList";
|
||||
@@ -11,11 +12,34 @@ export default function Home({
|
||||
onEdit,
|
||||
onDelete,
|
||||
onCancel,
|
||||
setEditingBook
|
||||
setEditingBook,
|
||||
searchQuery,
|
||||
setSearchQuery,
|
||||
statusFilter,
|
||||
setStatusFilter
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<h1 className="mb-4">Книги</h1>
|
||||
<div className="mb-3" style={{ maxWidth: 350 }}>
|
||||
<input
|
||||
type="text"
|
||||
className="form-control mb-2"
|
||||
placeholder="Поиск по названию"
|
||||
value={searchQuery}
|
||||
onChange={e => setSearchQuery(e.target.value)}
|
||||
/>
|
||||
<select
|
||||
className="form-select"
|
||||
value={statusFilter}
|
||||
onChange={e => setStatusFilter(e.target.value)}
|
||||
>
|
||||
<option value="">Все статусы</option>
|
||||
{statuses.map(s => (
|
||||
<option key={s.id} value={s.name}>{s.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<BookForm
|
||||
authors={authors}
|
||||
statuses={statuses}
|
||||
|
||||
Reference in New Issue
Block a user