import React from 'react'; import {useVINDecoder} from "../../hooks/customHooks"; import {Header, Table, TextInput} from "../ui"; export function VinDecoderCalculator() { const basicKeys = ['Country', 'Manufacturer', 'Region', 'Years']; const detailsKeys = ['Body', 'Engine', 'Model', 'Plant', 'Transmission', 'Serial']; const {value, setValue, vin} = useVINDecoder(); let body =

Enter a VIN number above

; if (value && !vin) { body =

VIN number is invalid

; } if (vin && vin['country']) { let details =

No details

; if (vin['body']) { details = {detailsKeys.map(i => {i} {vin[i.toLowerCase()] || '(Unknown)'} )}
; } body = <> {basicKeys.map(i => {i} {vin[i.toLowerCase()]} )}
Details
{details} ; } return <>
VIN Number Decoder
setValue(e.target.value)} />
Decoded
{body} }