Skip to content

Commit

Permalink
feat: added filtering by author
Browse files Browse the repository at this point in the history
  • Loading branch information
Franqsanz committed Jun 25, 2024
1 parent 50d2ecc commit 8df892f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Categories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function Categories() {
display='flex'
key={_id}
as={NavLink}
to={`/books/search/category/${_id}`}
to={`/books/filter/category/${_id}`}
tabIndex={-1}
_hover={{ outline: 'none' }}
>
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/filters/Filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Filter({ onClose }: Props) {

function handleSearch(e: React.ChangeEvent<HTMLInputElement>) {
e.preventDefault();
navigate(`/books/search/${query}/${value}`);
navigate(`/books/filter/${query}/${value}`);
onClose();
}

Expand Down
12 changes: 6 additions & 6 deletions src/pages/Book.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default function Book() {
<Box>
<Link
as={NavLink}
to={`/books/search/category/${data.category[0]}`}
to={`/books/filter/category/${data.category[0]}`}
>
<MyTag
bg='green.50'
Expand Down Expand Up @@ -303,9 +303,9 @@ export default function Book() {
>
{data.authors.map((author, index) => (
<MyLink
external={true}
external={false}
key={index}
href={`https://www.google.com/search?q=${author}+escritor`}
href={`/books/filter/authors/${author}`}
data={author}
index={index !== data.authors.length - 1 && ','}
/>
Expand Down Expand Up @@ -333,7 +333,7 @@ export default function Book() {
<Box as='span'>
<MyLink
external={false}
href={`/books/search/year/${data.year}`}
href={`/books/filter/year/${data.year}`}
data={data.year}
/>
</Box>
Expand All @@ -355,7 +355,7 @@ export default function Book() {
<Box as='span'>
<MyLink
external={false}
href={`/books/search/language/${data.language}`}
href={`/books/filter/language/${data.language}`}
data={data.language}
/>
</Box>
Expand All @@ -379,7 +379,7 @@ export default function Book() {
<MyLink
external={false}
key={index}
href={`/books/search/category/${category}`}
href={`/books/filter/category/${category}`}
data={category}
index={index !== data.category.length - 1 && ','}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const routes = createBrowserRouter([
path: '/books',
children: [
{
path: 'search',
path: 'filter',
children: [
{
path: ':query/:param',
Expand Down

0 comments on commit 8df892f

Please sign in to comment.