Skip to content

Commit

Permalink
search page with popular genres
Browse files Browse the repository at this point in the history
  • Loading branch information
AmiltonCabral committed Sep 19, 2024
1 parent 040a8da commit d27dbe4
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 1 deletion.
Binary file added public/img/genres/biography.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/classic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/detective.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/fantasy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/horror.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/poems.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/romance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/genres/sciencefiction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/app/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
import SearchBar from "@/components/SearchBar";
import styles from "./search.module.css";
import Image from "next/image";
import Link from "next/link";

const genres = [
"biography",
"classic",
"detective",
"fantasy",
"horror",
"poems",
"romance",
"sciencefiction",
];

export default function Search() {
return (
<main>
<div className={styles.searchBarContainer}>
<SearchBar placeholder="Title, author or ISBN" width="100%" />
<h1 className={styles.title}>Explore popular genres</h1>

<ul className={styles.genresList}>
{genres.map((genre) => (
<li key={genre} className={styles.genreItem}>
<Link href="#">
<Image
src={`/img/genres/${genre}.png`}
alt="Biography"
width={165}
height={213}
/>
<p>{genre}</p>
</Link>
</li>
))}
</ul>
</div>
</main>
);
Expand Down
33 changes: 33 additions & 0 deletions src/app/search/search.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
.searchBarContainer {
margin-top: 2rem;
width: 70%;
padding-bottom: 8rem;
}

.title {
text-align: center;
margin: 4rem 0;
}

.genresList {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 4rem 0;
justify-content: space-around;
text-align: center;
}

@media (max-width: 768px) {
.genresList {
grid-template-columns: repeat(2, 1fr);
}
}

.genreItem {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
}

.genreItem a {
text-decoration: none;
color: inherit;
}
2 changes: 1 addition & 1 deletion src/components/SearchBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function SearchBar({ placeholder, width }: SearchBarProps) {
return (
<div style={{ width }} className={styles.searchBar}>
<FiSearch className={styles.icon} />
<input type="text" placeholder={placeholder} className={styles.input} />
<input type="search" placeholder={placeholder} className={styles.input} />
</div>
);
}

0 comments on commit d27dbe4

Please sign in to comment.