From 96c8ba64dd80552bc85b813a21ed1e05de3a61a0 Mon Sep 17 00:00:00 2001 From: Vazhin Tayeb Date: Fri, 15 Jan 2021 09:32:47 +0300 Subject: [PATCH] Renders vehicleData into the Table --- React/src/pages/components/Button.js | 4 +- React/src/pages/components/VehiclesMain.js | 52 ++++------------------ React/src/pages/components/table/Table.js | 39 ++++++++++------ 3 files changed, 37 insertions(+), 58 deletions(-) diff --git a/React/src/pages/components/Button.js b/React/src/pages/components/Button.js index 2f43dda..8006e9c 100644 --- a/React/src/pages/components/Button.js +++ b/React/src/pages/components/Button.js @@ -1,9 +1,9 @@ import React from "react"; -const Button = ({ onClickEvent, text }) => ( +const Button = ({ onClickEvent, text, classes = "" }) => ( diff --git a/React/src/pages/components/VehiclesMain.js b/React/src/pages/components/VehiclesMain.js index 8f89fa5..dd5c089 100644 --- a/React/src/pages/components/VehiclesMain.js +++ b/React/src/pages/components/VehiclesMain.js @@ -46,35 +46,6 @@ const VehiclesMain = () => { licensePlate: "9956443", type: 1, }, - - { - id: Math.floor(Math.random() * 200) + 1, - color: "White", - model: "Toyota Camry", - licensePlate: "9956443", - type: 1, - }, - { - id: Math.floor(Math.random() * 200) + 1, - color: "White", - model: "Toyota Camry", - licensePlate: "9956443", - type: 1, - }, - { - id: Math.floor(Math.random() * 200) + 1, - color: "White", - model: "Toyota Camry", - licensePlate: "9956443", - type: 1, - }, - { - id: Math.floor(Math.random() * 200) + 1, - color: "White", - model: "Toyota Camry", - licensePlate: "9956443", - type: 1, - }, ]); useEffect(() => { @@ -87,22 +58,14 @@ const VehiclesMain = () => { setVehicleData(vehicles); } - function getType(type) { - switch (type) { - case 1: - return "Sedan"; - case 2: - return "SUV"; - case 3: - return "Pickup"; - } - } - return (
{/*

Hello, {user.profile.given_name}.

*/} {vehicleData ? ( @@ -111,7 +74,7 @@ const VehiclesMain = () => { Your Vehicles: - +
{/*
    {vehicleData.map((v) => ( @@ -126,7 +89,10 @@ const VehiclesMain = () => { No vehicles yet. )} -
+
- - - - + + + + - - - - - - - + {vehicleData.map((vehicle) => ( + + + + + + + + ))} {/* */}
Actions