File tree Expand file tree Collapse file tree 3 files changed +5
-39
lines changed
addon/components/rose/code-editor/toolbar
app/styles/rose/components/code-editor Expand file tree Collapse file tree 3 files changed +5
-39
lines changed Original file line number Diff line number Diff line change 2121 data-test-code-editor-toolbar-menu-divider
2222 ></div >
2323 {{ /if }}
24- <CopyButton
25- @text ={{ @copyText }}
24+ <Hds::Copy::Button
25+ @text =' Copy code'
26+ @textToCopy ={{ @copyText }}
2627 @onSuccess ={{ this.copied }}
27- class =' rose-code-editor-toolbar__copy-button'
2828 data-test-code-editor-toolbar-copy-button
29- >
30- <Hds::Icon @name ={{ this.copyIconType }} @isInline ={{ true }} />
31- Copy code
32- </CopyButton >
29+ />
3330 </div >
3431</div >
Original file line number Diff line number Diff line change 44 */
55
66import Component from '@glimmer/component' ;
7- import { tracked } from '@glimmer/tracking' ;
87import { action } from '@ember/object' ;
9- import { later } from '@ember/runloop' ;
10-
11- export const COPY_ICON_TYPE = 'clipboard-copy' ;
12- export const COPIED_ICON_TYPE = 'clipboard-checked' ;
138
149export default class RoseCodeEditorToolbarComponent extends Component {
15- @tracked copyIconType = COPY_ICON_TYPE ;
16-
1710 @action
1811 copied ( ) {
19- let { onCopy } = this . args ;
20- let originalIconType = this . copyIconType ;
21-
22- this . copyIconType = COPIED_ICON_TYPE ;
23-
24- if ( onCopy ) {
25- onCopy ( ) ;
26- }
27- // eslint-disable-next-line ember/no-runloop
28- later ( ( ) => ( this . copyIconType = originalIconType ) , 1000 ) ;
12+ this . args . onCopy ?. ( ) ;
2913 }
3014}
Original file line number Diff line number Diff line change 6767 height : sizing .rems (xl );
6868 }
6969 }
70-
71- & __copy-button {
72- border : none ;
73- background-color : inherit ;
74- cursor : pointer ;
75- color : var (--ui-gray-starker-2 );
76- margin-right : sizing .rems (xs );
77- margin-left : sizing .rems (s );
78- height : sizing .rems (xl );
79- white-space : nowrap ;
80-
81- .hds-icon {
82- vertical-align : top ;
83- }
84- }
8570}
You can’t perform that action at this time.
0 commit comments