Newer
Older
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
import React from 'react';
import InputNumber from '../uielements/InputNumber';
import { notification } from '../index';
export default function({
price,
quantity,
image,
objectID,
cancelQuantity,
changeQuantity,
_highlightResult,
}) {
const onChange = value => {
if (!isNaN(value)) {
if (value !== quantity) {
changeQuantity(objectID, value);
}
} else {
notification('error', 'Please give valid number');
}
};
const totalPrice = (price * quantity).toFixed(2);
return (
<tr>
<td
className="isoItemRemove"
onClick={() => {
cancelQuantity(objectID);
}}
>
<a href="# ">
<i className="ion-android-close" />
</a>
</td>
<td className="isoItemImage">
<img alt="#" src={image} />
</td>
<td className="isoItemName">
<h3>{_highlightResult.name.value}</h3>
<p>{_highlightResult.description.value}</p>
</td>
<td className="isoItemPrice">
<span className="itemPricePrefix">$</span>
{price.toFixed(2)}
</td>
<td className="isoItemQuantity">
<InputNumber
min={1}
max={1000}
value={quantity}
step={1}
onChange={onChange}
/>
</td>
<td className="isoItemPriceTotal">${totalPrice}</td>
</tr>
);
}