homeflowjs 0.11.4 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homeflowjs",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "description": "JavaScript toolkit for Homeflow themes",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,6 +9,8 @@ const StampDutyCalculator = ({ scotland, themePreferences }) => {
9
9
  const [type, setType] = useState('residential');
10
10
  const [purchaseType, setPurchaseType] = useState('firstTimeBuyer')
11
11
  const [purchasePrice, setPurchasePrice] = useState();
12
+ const [firstTimeBuyer, setFirstTimeBuyer] = useState(false);
13
+ const [additionalProperty, setAdditionalProperty] = useState(false);
12
14
 
13
15
  const renderCalculator = () => {
14
16
  if (type === 'residential') {
@@ -16,8 +18,8 @@ const StampDutyCalculator = ({ scotland, themePreferences }) => {
16
18
  <DefaultCalculator
17
19
  purchasePrice={purchasePrice}
18
20
  setPurchasePrice={setPurchasePrice}
19
- firstTimeBuyer={purchaseType === 'firstTimeBuyer'}
20
- additionalProperty={purchaseType === 'additional'}
21
+ firstTimeBuyer={firstTimeBuyer}
22
+ additionalProperty={additionalProperty}
21
23
  ukResident
22
24
  />
23
25
  );
@@ -61,22 +63,22 @@ const StampDutyCalculator = ({ scotland, themePreferences }) => {
61
63
  </div>
62
64
  <div className="switches">
63
65
  <div className="form-group">
64
- <button
65
- type="button"
66
- className={`stamp-duty-cal__type ${purchaseType === 'firstTimeBuyer' ? 'selected' : ''}`}
67
- onClick={() => setPurchaseType('firstTimeBuyer')}
68
- >
69
- First Time Buyer
70
- </button>
66
+ <input
67
+ type="checkbox"
68
+ id="firstTime"
69
+ checked={firstTimeBuyer}
70
+ onChange={() => setFirstTimeBuyer(prev => !prev)}
71
+ />
72
+ <label htmlFor="firstTime">First Time Buyer</label>
71
73
  </div>
72
74
  <div className="form-group">
73
- <button
74
- type="button"
75
- className={`stamp-duty-cal__type ${purchaseType === 'additional' ? 'selected' : ''}`}
76
- onClick={() => setPurchaseType('additional')}
77
- >
78
- Additional Property
79
- </button>
75
+ <input
76
+ type="checkbox"
77
+ id="additionalProperty"
78
+ checked={additionalProperty}
79
+ onChange={() => setAdditionalProperty(prev => !prev)}
80
+ />
81
+ <label htmlFor="additionalProperty">Additional Property</label>
80
82
  </div>
81
83
  </div>
82
84
  {renderCalculator()}