-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathEditHero.js
More file actions
50 lines (48 loc) · 1.25 KB
/
EditHero.js
File metadata and controls
50 lines (48 loc) · 1.25 KB
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
import React from 'react';
const EditHero = ({ selectedHero, addingHero, onChange, onSave, onCancel }) => {
if (selectedHero) {
return (
<div>
<div className="editfields">
<div>
<label>id: </label>
{addingHero
? <input
type="number"
name="id"
placeholder="id"
value={selectedHero.id}
onChange={onChange}
/>
: <label className="value">
{selectedHero.id}
</label>}
</div>
<div>
<label>name: </label>
<input
name="name"
value={selectedHero.name}
placeholder="name"
onChange={onChange}
/>
</div>
<div>
<label>saying: </label>
<input
name="saying"
value={selectedHero.saying}
placeholder="saying"
onChange={onChange}
/>
</div>
</div>
<button onClick={onCancel}>Cancel</button>
<button onClick={onSave}>Save</button>
</div>
);
} else {
return <div />;
}
};
export default EditHero;