diff --git a/package-lock.json b/package-lock.json index e95c4d1..833fb42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,8 +23,9 @@ "react-redux": "^9.1.0", "react-router-dom": "^6.22.0", "react-scripts": "5.0.1", + "uuid": "^9.0.1", + "web-vitals": "^2.1.4" "redux-persist": "^6.0.0", - "web-vitals": "^2.1.4", "yup": "^1.3.3" }, "devDependencies": { @@ -17830,6 +17831,14 @@ "websocket-driver": "^0.7.4" } }, + "node_modules/sockjs/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/source-list-map": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", @@ -19684,9 +19693,13 @@ } }, "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } diff --git a/package.json b/package.json index b92709f..1436e58 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "react-redux": "^9.1.0", "react-router-dom": "^6.22.0", "react-scripts": "5.0.1", + "uuid": "^9.0.1", "redux-persist": "^6.0.0", "web-vitals": "^2.1.4", "yup": "^1.3.3" diff --git a/src/assets/imgs/facebook.png b/src/assets/imgs/facebook.png new file mode 100644 index 0000000..6198489 Binary files /dev/null and b/src/assets/imgs/facebook.png differ diff --git a/src/assets/imgs/instagram.png b/src/assets/imgs/instagram.png new file mode 100644 index 0000000..0ce6cfa Binary files /dev/null and b/src/assets/imgs/instagram.png differ diff --git a/src/assets/imgs/shape.png b/src/assets/imgs/shape.png new file mode 100644 index 0000000..e1c0e9f Binary files /dev/null and b/src/assets/imgs/shape.png differ diff --git a/src/assets/imgs/triangle.png b/src/assets/imgs/triangle.png new file mode 100644 index 0000000..974dd7d Binary files /dev/null and b/src/assets/imgs/triangle.png differ diff --git a/src/assets/imgs/twitter.png b/src/assets/imgs/twitter.png new file mode 100644 index 0000000..fb06c29 Binary files /dev/null and b/src/assets/imgs/twitter.png differ diff --git a/src/components/CarList.jsx b/src/components/CarList.jsx index dc86127..867066a 100644 --- a/src/components/CarList.jsx +++ b/src/components/CarList.jsx @@ -1,17 +1,108 @@ -import React from 'react'; +import React, { useState } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; +import { v4 as uuidv4 } from 'uuid'; +import triangle from '../assets/imgs/triangle.png'; +import facebook from '../assets/imgs/facebook.png'; +import twitter from '../assets/imgs/twitter.png'; +import instagram from '../assets/imgs/instagram.png'; +import shape from '../assets/imgs/shape.png'; function CarList({ cars }) { + const [currentIndex, setCurrentIndex] = useState(0); + + const totalCars = cars.length; + const maxIndex = totalCars - 1; + const totalSlides = Math.ceil(totalCars / 3); + + const handleNext = () => { + const nextIndex = Math.min(currentIndex + 3, maxIndex); + setCurrentIndex(nextIndex); + }; + + const handlePrev = () => { + const prevIndex = Math.max(currentIndex - 3, 0); + setCurrentIndex(prevIndex); + }; + return ( -
- {cars?.map((car) => ( - - {car.name} -

{car.name}

-

{car.description}

- - ))} +
+
+
+ {[...Array(totalSlides)].map((_, index) => ( + + ))} +
+
+
+ +
+ {cars.slice(currentIndex, Math.min(currentIndex + 3, totalCars)).map((car) => ( +
+
+ + {car.name} + +
+
+

{car.name}

+
+ shape +
+

{car.description}

+
+ facebook + twitter + instagram +
+
+
+ ))} +
+ + +
); } diff --git a/src/components/Sidebar.jsx b/src/components/Sidebar.jsx index bd623db..7226dd7 100644 --- a/src/components/Sidebar.jsx +++ b/src/components/Sidebar.jsx @@ -8,7 +8,7 @@ const SideNavBar = () => { const { isLoggedIn, role } = useSelector((state) => state.auth); return ( -