aboutsummaryrefslogtreecommitdiff
path: root/src/components/Form/Address/NewAddressPane.tsx
blob: 4dd37887fd96ecb22402959f4479ba24d39833cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * OpenBills - Self hosted browser app to generate and keep track of simple invoices
 * Version - 0
 * Licensed under the MIT license - https://opensource.org/licenses/MIT
 *
 * Copyright (c) 2021 Vidhu Kant Sharma
*/

import React, { Dispatch, SetStateAction, useState } from "react";
import "./../Form.scss";
import { Address } from "./../../../Interfaces/interfaces"

interface Props {
  heading: string
  address: Address
  setAddress: Dispatch<SetStateAction<Address>>
}

const NewAddressPane: React.FC<Props> = (props) => {
  const address = props.address;

return (
  <div className={"widePane formPane"}>
    <h3>{props.heading}</h3>

    <label>
      Address: <input className={"wideInputBox"} 
        type="text" value={address.AddressLine} onChange={
          ({target: {value}}) => props.setAddress({...address, AddressLine: value})
        }
      required />
    </label>

    <label>
      City: <input className={"wideInputBox"} 
        type="text" value={address.City} onChange={
          ({target: {value}}) => props.setAddress({...address, City: value})
        }
      required />
    </label>

    <label>
      State: <input className={"wideInputBox"} 
        type="text" value={address.State} onChange={
          ({target: {value}}) => props.setAddress({...address, State: value})
        }
      required />
    </label>

    <label>
      PIN Code: <input className={"wideInputBox"} 
        type="text" value={address.PINCode} onChange={
          ({target: {value}}) => props.setAddress({...address, PINCode: value})
        }
      required />
    </label>

    <label>
      Country: <input className={"wideInputBox"} 
        type="text" value={address.Country} onChange={
          ({target: {value}}) => props.setAddress({...address, Country: value})
        }
      required />
    </label>
  </div>
  );
}

export default NewAddressPane;