-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathconfigure-project.js
More file actions
74 lines (70 loc) · 2.1 KB
/
Copy pathconfigure-project.js
File metadata and controls
74 lines (70 loc) · 2.1 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { Section } from './index';
import React, { useState } from 'react';
export default ({ current, stepNumber, fields, submit }) => {
const [state, setState] = useState(fields);
const onSubmit = event => {
event.preventDefault();
submit(state);
};
return (
<Section
title="Configure Project"
currentState={current}
state={['configuring_project']}
stepNumber={stepNumber}
inactive={null}
completed={
<div>
<p>Project has been configured.</p>
</div>
}
active={
<div className="mt-4">
<form onSubmit={onSubmit}>
{state.map(({ name, secretName, description, value }, idx) => (
<div key={secretName}>
<div className="mb-4">
<p className="mb-2">{description}:</p>
</div>
<div className="mr-8">
<label htmlFor="account_id" className="block font-medium leading-5 text-gray-1">
{name}
</label>
<div className="mt-1 mb-6 relative">
<input
id="account_id"
className="form-input block w-64 p-2 rounded-md border border-gray-7 sm:text-sm sm:leading-5"
onChange={({ target: { value } }) => {
setState(fields => {
// Copy the Array so that
// React can detect the change
// based on ref equality
const newFields = [...fields];
newFields[idx].value = value;
return newFields;
});
}}
placeholder="Enter a value"
required
value={value}
/>
</div>
</div>
</div>
))}
<div className="mt-6 mb-4 flex items-center">
<span className="block mr-4">
<button
type="submit"
className={`flex items-center justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-blue-4 hover:bg-blue-4 focus:outline-none focus:border-blue-4 focus:shadow-outline-indigo active:bg-blue-4 transition duration-150 ease-in-out`}
>
Configure
</button>
</span>
</div>
</form>
</div>
}
/>
);
};