mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
⚡ component to copy text to clipboard
This commit is contained in:
parent
bc67f26327
commit
63e1a5e899
9
src/app/ui/copy-text/copy-text.component.html
Normal file
9
src/app/ui/copy-text/copy-text.component.html
Normal file
@ -0,0 +1,9 @@
|
||||
<button
|
||||
(click)='handleClick()'
|
||||
[cbContent]="textToCopy"
|
||||
[ngxClipboard]
|
||||
class=" btn btn--primary btn--outline"
|
||||
id="copyLink" >
|
||||
<i class='fa fa-copy' ></i >
|
||||
{{"admin.copy_link" |translate}} " {{ textToCopy}}"
|
||||
</button >
|
0
src/app/ui/copy-text/copy-text.component.scss
Normal file
0
src/app/ui/copy-text/copy-text.component.scss
Normal file
25
src/app/ui/copy-text/copy-text.component.spec.ts
Normal file
25
src/app/ui/copy-text/copy-text.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {CopyTextComponent} from './copy-text.component';
|
||||
|
||||
describe('CopyTextComponent', () => {
|
||||
let component: CopyTextComponent;
|
||||
let fixture: ComponentFixture<CopyTextComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CopyTextComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CopyTextComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
26
src/app/ui/copy-text/copy-text.component.ts
Normal file
26
src/app/ui/copy-text/copy-text.component.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {MessageService} from "primeng/api";
|
||||
|
||||
@Component({
|
||||
selector: 'framadate-copy-text',
|
||||
templateUrl: './copy-text.component.html',
|
||||
styleUrls: ['./copy-text.component.scss']
|
||||
})
|
||||
export class CopyTextComponent implements OnInit {
|
||||
@Input() public textToCopy: any;
|
||||
|
||||
constructor(private messageService: MessageService,) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Texte copié',
|
||||
detail: this.textToCopy
|
||||
})
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user