Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor search #17

Merged
merged 3 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ bun dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More
Expand All @@ -31,6 +29,6 @@ You can check out [the Next.js GitHub repository](https://github.com/vercel/next

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
The main branch is automatically deployed to [BookHive](https://thebookhive.vercel.app/) with [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) the creator of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
2 changes: 2 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
--font-color-secondary: #4a4545;

--color-primary: #ffdd4b;
--color-grey: #555;

--background-primary: #fffce0;
--background-secondary: #ffffff;
--background-tertiary: #e7e7e7;
--background-grey: #d3d3d3;
}

* {
Expand Down
5 changes: 4 additions & 1 deletion src/app/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import SearchBar from "@/components/SearchBar";
import styles from "./search.module.css";

export default function Search() {
return (
<main>
<SearchBar placeholder="Title, author or ISBN" />
<div className={styles.searchBarContainer}>
<SearchBar placeholder="Title, author or ISBN" width="100%" />
</div>
</main>
);
}
4 changes: 4 additions & 0 deletions src/app/search/search.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.searchBarContainer {
margin-top: 2rem;
width: 70%;
}
7 changes: 4 additions & 3 deletions src/components/SearchBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { FiSearch } from "react-icons/fi";
import styles from "./profile.module.css";
import styles from "./search-bar.module.css";

type SearchBarProps = {
placeholder?: string;
width?: string;
};

export default function SearchBar({ placeholder }: SearchBarProps) {
export default function SearchBar({ placeholder, width }: SearchBarProps) {
return (
<div className={styles.searchBar}>
<div style={{ width }} className={styles.searchBar}>
<FiSearch className={styles.icon} />
<input type="text" placeholder={placeholder} className={styles.input} />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.searchBar {
display: flex;
align-items: center;
background-color: #d3d3d3;
background-color: var(--background-grey);
border-radius: 12px;
padding: 10px 15px;
width: 300px;
}

.icon {
Expand All @@ -18,5 +17,6 @@
background-color: transparent;
outline: none;
font-size: 16px;
color: #555;
width: 100%;
color: var(--color-grey);
}
Loading