Total Complexity | 1 |
Complexity/F | 0 |
Lines of Code | 44 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import React from "react"; |
||
2 | const History = ({ userData }) => { |
||
3 | const userInfo = () => { |
||
4 | return userData.history.map((item, index) => { |
||
5 | return ( |
||
6 | <tr key={index} className="border-b border-gray-400"> |
||
7 | <td>{item.scooterName}</td> |
||
8 | <td>{item.date}</td> |
||
9 | <td>{item.totalMin}</td> |
||
10 | <td>{item.totalPrice} </td> |
||
11 | <td>{item.distance}</td> |
||
12 | </tr> |
||
13 | ); |
||
14 | }); |
||
15 | }; |
||
16 | |||
17 | if (!userData.history) { |
||
18 | return <div>Loading</div>; |
||
19 | } |
||
20 | |||
21 | return ( |
||
22 | <> |
||
23 | <div className="pr-32"> |
||
24 | <h1 className="text-3xl font-semibold mb-5">History</h1> |
||
25 | <table className="w-full text-lg content-between text-left"> |
||
26 | <thead |
||
27 | className=" bg-sidebarBlue text-slate-800 |
||
28 | font-semibold" |
||
29 | > |
||
30 | <th>Scooter Name</th> |
||
31 | <th>Date</th> |
||
32 | <th>Minutes</th> |
||
33 | <th>Price (SEK)</th> |
||
34 | <th>Distance (KM)</th> |
||
35 | </thead> |
||
36 | <tbody>{userInfo()}</tbody> |
||
37 | </table> |
||
38 | </div> |
||
39 | </> |
||
40 | ); |
||
41 | }; |
||
42 | |||
43 | export default History; |
||
44 |