Skip to content

Commit

Permalink
navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
MetinVn committed Jul 12, 2024
1 parent 1e62853 commit 44a4eee
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/layouts/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const Sidebar = ({ colors }) => {

const handleNavigation = (navigation) => {
if (navigation === "author") {
navigate("/home/author");
navigate("/author");
} else if (navigation === "book") {
navigate("/home/books");
navigate("/books");
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/layouts/Welcome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Welcome() {
setLoad(true);
setTimeout(() => {
setLoad(false);
navigate("/home/books");
navigate("./books");
}, 1200);
}

Expand Down
22 changes: 5 additions & 17 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,12 @@ import AuthorSearch from "./pages/AuthorSearch.jsx";
import BookSearch from "./pages/BookSearch.jsx";
ReactDOM.createRoot(document.getElementById("root")).render(
<>
<Router>
<Router basename="/Open-Library-Search-API">
<Routes>
<Route exact path="Open-Library-Search-API/home/" Component={App} />
<Route
exact
path="Open-Library-Search-API/home/author/:authorKey"
Component={AuthorInfo}
/>
<Route
exact
path="Open-Library-Search-API/home/author/"
Component={AuthorSearch}
/>
<Route
exact
path="Open-Library-Search-API/home/books/"
Component={BookSearch}
/>
<Route exact path="/" Component={App} />
<Route exact path="/author/:authorKey" Component={AuthorInfo} />
<Route exact path="/author/" Component={AuthorSearch} />
<Route exact path="/books/" Component={BookSearch} />
</Routes>
</Router>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AuthorSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ function AuthorSearch() {
<Grid container spacing={2} justifyContent="center">
{data.slice(0, visibleItems).map((item, index) => (
<Grid item xs={12} sm={6} md={4} key={index}>
<Link to={`/home/author/${item.key}`} className="no-underline">
<Link to={`/author/${item.key}`} className="no-underline">
<Box
sx={{
border: `1px solid ${
Expand Down
4 changes: 1 addition & 3 deletions src/pages/BookSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,7 @@ function BookSearch() {
<Grid container spacing={2} justifyContent="center">
{data.slice(0, visibleItems).map((item, index) => (
<Grid item xs={12} sm={6} md={4} key={index}>
<Link
to={`/home/author/${item.author_key}`}
className="no-underline">
<Link to={`/author/${item.author_key}`} className="no-underline">
<Box
sx={{
border: `1px solid ${
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: "/Open-Library-Search-API/home",
base: "/Open-Library-Search-API/",
});

0 comments on commit 44a4eee

Please sign in to comment.