Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-ch committed Dec 25, 2024
1 parent 54c897f commit 6a94f4f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
border-radius: 1rem;
padding: 3px;
max-width: 800px;
margin-bottom: 2rem;
margin-top: 5rem;
margin-bottom: 1rem;
margin-top: 2rem;
}

.detailed-img {
Expand Down
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ function App() {

return (
<Routes>
<Route path="/newPokeGenerator/" element={<MainApp />} />
<Route path="/" element={<MainApp />} />
<Route path="/newPokeGenerator/:name" element={<DetailedPokemon />} />
<Route path="/:name" element={<DetailedPokemon />} />
{/* <Route path="/" element={<MainApp />} /> */}
<Route path=":name" element={<DetailedPokemon />} />
{/* <Route path="/:name" element={<DetailedPokemon />} /> */}
</Routes>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function CardList({ pokemon }: { pokemon: PokemonsType[] }) {
description: po.description,
image: po.img,
};
navigate(`/newPokeGenerator/${po.name}`, { state: data });
navigate(`/${po.name}`, { state: data });
}

return (
Expand Down
22 changes: 10 additions & 12 deletions src/DetailedPokemon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,20 @@ const DetailedPokemon = () => {
});
}
}, [state]);


function backToList() {
navigate("/newPokeGenerator");
navigate("/");
}

return (
state ?
return state ? (
<div
style={{
display: "flex",
maxWidth: "100vw",
maxHeight: "100vh",
flexDirection: "column",

//margin: 10,
// padding: 0,
alignItems: "center",
justifyContent: "center",
//overflow: "hidden",
}}
>
<button onClick={backToList}>Back to List</button>
Expand All @@ -62,10 +56,12 @@ const DetailedPokemon = () => {
{state?.type}
</h3>
<img src={state.image} alt={state?.name} className="detailed-img" />
<h4 style={{ color: "whitesmoke" }}>{state?.description}</h4>
<h4 style={{ color: "whitesmoke", padding: "5px" }}>
{state?.description}
</h4>
</div>
</div>
:
) : (
<div
style={{
display: "flex",
Expand Down Expand Up @@ -100,10 +96,12 @@ const DetailedPokemon = () => {
alt={pokePath?.name}
className="detailed-img"
/>
<h4 style={{ color: "whitesmoke" }}>{pokePath?.description}</h4>
<h4 style={{ color: "whitesmoke", padding: "5px" }}>
{pokePath?.description}
</h4>
</div>
</div>
)
);
};

export default DetailedPokemon;

0 comments on commit 6a94f4f

Please sign in to comment.