Skip to content

Commit ecf9182

Browse files
Add a remove button
1 parent 27baa58 commit ecf9182

File tree

3 files changed

+54
-18
lines changed

3 files changed

+54
-18
lines changed

app/javascript/components/provision-entry-point/index.jsx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState, useEffect } from 'react';
22
import PropTypes from 'prop-types';
33
import { Button, TextInput } from 'carbon-components-react';
4-
import { TreeViewAlt16 } from '@carbon/icons-react';
4+
import { Close16, TreeViewAlt16 } from '@carbon/icons-react';
55
import { useFieldApi } from '@@ddf';
66
import WorkflowEntryPoints from '../workflows/workflow-entry-points';
77

@@ -46,13 +46,25 @@ const ProvisionEntryPoint = (props) => {
4646
<div className="entry-point-text-input">
4747
<TextInput id={id} type="text" labelText={__(label)} onChange={(value) => setTextValue(value.target.value)} value={textValue} />
4848
</div>
49-
<div className="entry-point-buttons">
50-
<Button
51-
renderIcon={TreeViewAlt16}
52-
iconDescription={sprintf(__('Click to select %s'), label)}
53-
hasIconOnly
54-
onClick={() => setShowModal(true)}
55-
/>
49+
<div className='entry-point-buttons'>
50+
<div className="entry-point-open">
51+
<Button
52+
renderIcon={TreeViewAlt16}
53+
iconDescription={sprintf(__('Click to select %s'), label)}
54+
hasIconOnly
55+
onClick={() => setShowModal(true)}
56+
/>
57+
</div>
58+
<div className="entry-point-remove">
59+
<Button
60+
renderIcon={Close16}
61+
iconDescription={sprintf(__('Remove this %s'), label)}
62+
hasIconOnly
63+
onClick={() => {
64+
setSelectedValue({});
65+
}}
66+
/>
67+
</div>
5668
</div>
5769
</div>
5870
</div>

app/javascript/spec/provision-entry-point/__snapshots__/provision-entry-point.spec.js.snap

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,36 @@ exports[`CodeEditor component should render correctly 1`] = `
1919
<div
2020
className="entry-point-buttons"
2121
>
22-
<Button
23-
hasIconOnly={true}
24-
iconDescription="Click to select Provisioning Entry Point"
25-
onClick={[Function]}
26-
renderIcon={
27-
Object {
28-
"$$typeof": Symbol(react.forward_ref),
29-
"render": [Function],
22+
<div
23+
className="entry-point-open"
24+
>
25+
<Button
26+
hasIconOnly={true}
27+
iconDescription="Click to select Provisioning Entry Point"
28+
onClick={[Function]}
29+
renderIcon={
30+
Object {
31+
"$$typeof": Symbol(react.forward_ref),
32+
"render": [Function],
33+
}
3034
}
31-
}
32-
/>
35+
/>
36+
</div>
37+
<div
38+
className="entry-point-remove"
39+
>
40+
<Button
41+
hasIconOnly={true}
42+
iconDescription="Remove this Provisioning Entry Point"
43+
onClick={[Function]}
44+
renderIcon={
45+
Object {
46+
"$$typeof": Symbol(react.forward_ref),
47+
"render": [Function],
48+
}
49+
}
50+
/>
51+
</div>
3352
</div>
3453
</div>
3554
</div>

app/stylesheet/workflows.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@
4242
}
4343

4444
.entry-point-buttons {
45+
display: inline-flex;
4546
margin-top: 20px;
47+
48+
.entry-point-open {
49+
margin-right: 10px;
50+
}
4651
}
4752
}

0 commit comments

Comments
 (0)