Skip to content

Commit

Permalink
add details
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolaus-B committed Mar 24, 2024
1 parent f921a20 commit 6bcc904
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/components/Car/Car.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
FavouriteButton,
HeadInfo,
HeadInfocontainer,
HeadName,
LocationAndRating,
PriceContainer,
ReviewsAndStarContainer,
Expand All @@ -18,6 +19,7 @@ import { Details } from "../Details/Details";
import { useDispatch } from "react-redux";
import { toggleFavourite } from "../../redux/cars/carsSlice";
import { useIsFavourite } from "../../hooks/useIsFavourite";
import { Detail } from "../Details/Detail";

export const Car = ({ car, hidden }) => {
const [modalIsOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -47,7 +49,7 @@ export const Car = ({ car, hidden }) => {
></CarImage>
<div>
<HeadInfocontainer>
<HeadInfo>{car.name}</HeadInfo>
<HeadName>{car.name}</HeadName>
<PriceContainer>
<HeadInfo>{car.price}.00</HeadInfo>
<FavouriteButton onClick={() => toogleFavouriteCar(car._id)}>
Expand All @@ -69,6 +71,8 @@ export const Car = ({ car, hidden }) => {
</LocationAndRating>
<Desctiption>{car.description}</Desctiption>
<TagsContainer>
<Detail detail={"adults"} value={car.adults} iconId={"people"} />
<Detail detail={car.transmission} value={""} iconId={"automatic"} />
<Details details={car.details} />
</TagsContainer>
<ShowMoreBtn onClick={() => openModal()}>Show more</ShowMoreBtn>
Expand Down
13 changes: 12 additions & 1 deletion src/components/Car/Car.styled.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,19 @@ export const HeadInfocontainer = styled.div`
export const PriceContainer = styled.div`
display: flex;
gap: 10px;
/* margin-bottom: 24px; */
`;

export const HeadName = styled.p`
width: 370px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: ${(p) => p.theme.fonts.bigSize};
line-height: 30px;
font-weight: ${(p) => p.theme.fonts.bold};
`;

export const HeadInfo = styled.p`
font-size: ${(p) => p.theme.fonts.bigSize};
line-height: 30px;
Expand Down
14 changes: 14 additions & 0 deletions src/components/Details/Detail.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { uid } from "uid";
import { TagContainer, TagText } from "./Details.styled";
import { Icon } from "../Icon/Icon";

export const Detail = ({ detail, value, iconId }) => {
return (
<TagContainer key={uid()}>
<Icon width={20} height={20} iconId={iconId} />
<TagText>
{value} {detail}
</TagText>
</TagContainer>
);
};
3 changes: 3 additions & 0 deletions src/components/FeaturesPopUp/FeaturesPopUp.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Detail } from "../Details/Detail";
import { Details } from "../Details/Details";
import {
DetailsContainer,
Expand All @@ -16,6 +17,8 @@ export const FeaturesPopUp = ({ car }) => {
<FeaturesContainer>
<FeaturesWrapper>
<DetailsContainer>
<Detail detail={"adults"} value={car.adults} iconId={"people"} />
<Detail detail={car.transmission} value={""} iconId={"automatic"} />
<Details details={car.details} />
</DetailsContainer>
<FeaturedHead>Vehicle details</FeaturedHead>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loader/Loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const Loader = () => {
<Backbrop>
<LoaderContainer>
<RotatingLines
strokeColor="#4f58fd"
strokeColor="#D84343"
strokeWidth="5"
animationDuration="0.75"
width="96"
Expand Down
9 changes: 6 additions & 3 deletions src/pages/NotFoundPage.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Link } from "react-router-dom";

export default function NotFoundPage() {
return (
<section>
<div>
<p>NotFoundPage</p>
</div>
<div>Not Found Page</div>
<p>
Click to return to <Link to="/">home</Link>
</p>
</section>
);
}

0 comments on commit 6bcc904

Please sign in to comment.