()
| 3 | import {useState} from 'react' |
| 4 | |
| 5 | function App() { |
| 6 | |
| 7 | const data = [ |
| 8 | {brand:"Fiat", color:"green", model:"500L", price:7000, "year":2020,"id":1}, |
| 9 | {brand:"Peugeot", color:"red", model:"5008", price:8000, "year":2018,"id":2}, |
| 10 | {brand:"Volkswagen", color:"white", model:"Golf 7", price:8500, "year":2019,"id":3}, |
| 11 | {brand:"Fiat", color:"green", model:"Tipo", price:10000, "year":2019,"id":4}, |
| 12 | {brand:"Kia", color:"black", model:"Ceed", price:6000, "year":2010,"id":5}, |
| 13 | {brand:"Volkswagen", color:"white", model:"Golf 7", price:8500, "year":2019,"id":15}, |
| 14 | {brand:"Fiat", color:"gray", model:"Ritmo", price:300, "year":1990,"id":21} |
| 15 | ] |
| 16 | |
| 17 | const [budget, setBudget] = useState(4000) |
| 18 | const onChangeHandler = event=>setBudget(event.target.value) |
| 19 | |
| 20 | return ( |
| 21 | <div className="App max-w-3xl mx-auto h-full"> |
| 22 | <Header/> |
| 23 | <div className="border-2 border-yellow-500 my-5 p-3">Your current budget is: <span className="">{budget}</span></div> |
| 24 | <div className="grid grid-cols-3 my-3 gap-3"> |
| 25 | {data.map( |
| 26 | (el)=>{ |
| 27 | |
| 28 | return ( |
| 29 | (el.price<budget)&&<Card key={el.id} car = {el} /> |
| 30 | ) |
| 31 | } |
| 32 | )} |
| 33 | </div> |
| 34 | <div className="bg-gray-300 rounded-md p-3"> |
| 35 | <label htmlFor="budget">Budget:</label> |
nothing calls this directly
no outgoing calls
no test coverage detected