File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
8
import './Builder.scss' ;
9
9
import DynamicTextInput from './common/DynamicTextInput' ;
10
10
import PermissionInput from './common/PermissionInput' ;
11
+ import CopyToClipboard from 'react-copy-to-clipboard' ;
12
+ import ToastMaker from 'toastmaker' ;
11
13
12
14
class Builder extends Component {
13
15
state = {
@@ -163,9 +165,18 @@ class Builder extends Component {
163
165
< div className = "header" ref = { this . headerDiv } >
164
166
< div className = "text" >
165
167
< code >
166
- { generatedCommand != null && ( < span > { generatedCommand } </ span > ) }
168
+ { generatedCommand != null && < span > { generatedCommand } </ span > }
167
169
</ code >
168
170
</ div >
171
+ < CopyToClipboard text = { generatedCommand } >
172
+ < button className = "copy" onClick = { ( e ) => ToastMaker ( "Copied!" ) } >
173
+ < span className = "copy-icon" title = "copy" >
174
+ < FontAwesomeIcon icon = "copy" color = "white" size = "lg" />
175
+ </ span > < br />
176
+ < span className = "copy-label" > COPY</ span >
177
+ </ button >
178
+ </ CopyToClipboard >
179
+
169
180
</ div >
170
181
171
182
< div className = "content" ref = { this . contentDiv } >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ $builder-header-min-height: 50px;
4
4
$header-padding-vertical : 5px ;
5
5
$checkbox-size : 30px ;
6
6
$form-bottom-button-spacing : 15px ;
7
+ $command-copy-button-width : 50px ;
7
8
8
9
.builder {
9
10
> .header {
@@ -16,12 +17,32 @@ $form-bottom-button-spacing: 15px;
16
17
min-height : $builder-header-min-height ;
17
18
min-width : auto ;
18
19
padding : $header-padding-vertical 10px ;
20
+ padding-right : $command-copy-button-width ;
19
21
position : fixed ;
20
22
text-align : center ;
21
23
width : 100% ;
22
24
z-index : 100 ;
23
25
.text {
24
26
width : 100% ;
27
+ user-select : none ;
28
+ }
29
+ button .copy {
30
+ background-color : $color-primary ;
31
+ border : none ;
32
+ border-left : 1px solid lighten ($color-primary , 50% );
33
+ outline : none ;
34
+ position : absolute ;
35
+ right : 0 ;
36
+ height : 100% ;
37
+ width : $command-copy-button-width ;
38
+ cursor : pointer ;
39
+ .copy-icon {
40
+ padding : 2px ;
41
+ }
42
+ .copy-label {
43
+ font-size : xx-small ;
44
+ color : white ;
45
+ }
25
46
}
26
47
}
27
48
> .content {
You can’t perform that action at this time.
0 commit comments