Skip to content

Commit

Permalink
add no select cars
Browse files Browse the repository at this point in the history
  • Loading branch information
luzhnyak committed Feb 17, 2024
1 parent 868b217 commit ca7e6ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/Favorites/Favorites.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import css from "./Favorites.module.css";
import { selectAllFavoritesCars } from "../../redux/favorites/selectors";

import Card from "../Card/Card";
import { Link } from "react-router-dom";

const Favorites = () => {
const cars = useSelector(selectAllFavoritesCars);
Expand All @@ -13,10 +14,16 @@ const Favorites = () => {
<>
<div className={css.container}>
<section className={css.sectionCatalog}>
{cars.length &&
{cars?.length > 0 ? (
cars.map((car) => {
return <Card key={car.id} data={car} />;
})}
})
) : (
<p className={css.noSelect}>
No selected cars yet. Explore our{" "}
<Link to="/catalog">catalog</Link> now.
</p>
)}
</section>
</div>
</>
Expand Down
13 changes: 13 additions & 0 deletions src/components/Favorites/Favorites.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@
margin-left: auto;
margin-right: auto;
}

.noSelect {
margin-top: 100px;
font-size: 20px;
a {
text-decoration: none;
font-weight: 600;
color: var(--primary-color-blue);
&:hover {
color: var(--active-color-blue);
}
}
}

0 comments on commit ca7e6ca

Please sign in to comment.