aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-main/buttons')
-rw-r--r--client/src/app/shared/shared-main/buttons/copy-button.component.html9
-rw-r--r--client/src/app/shared/shared-main/buttons/copy-button.component.scss15
-rw-r--r--client/src/app/shared/shared-main/buttons/copy-button.component.ts22
-rw-r--r--client/src/app/shared/shared-main/buttons/index.ts1
4 files changed, 47 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-main/buttons/copy-button.component.html b/client/src/app/shared/shared-main/buttons/copy-button.component.html
new file mode 100644
index 000000000..a99c0a93a
--- /dev/null
+++ b/client/src/app/shared/shared-main/buttons/copy-button.component.html
@@ -0,0 +1,9 @@
1<button
2 class="btn btn-outline-secondary btn-sm copy-button"
3 [cdkCopyToClipboard]="value" (click)="activateCopiedMessage()"
4 [title]="title" [ngClass]="{ 'is-input-group': isInputGroup }"
5>
6 <my-global-icon iconName="copy"></my-global-icon>
7
8 <ng-content></ng-content>
9</button>
diff --git a/client/src/app/shared/shared-main/buttons/copy-button.component.scss b/client/src/app/shared/shared-main/buttons/copy-button.component.scss
new file mode 100644
index 000000000..7e3720418
--- /dev/null
+++ b/client/src/app/shared/shared-main/buttons/copy-button.component.scss
@@ -0,0 +1,15 @@
1@use '_variables' as *;
2@use '_mixins' as *;
3
4button:not(.is-input-group) {
5 border: 0;
6}
7
8.is-input-group {
9 border-top-left-radius: 0;
10 border-bottom-left-radius: 0;
11}
12
13my-global-icon {
14 width: 15px;
15}
diff --git a/client/src/app/shared/shared-main/buttons/copy-button.component.ts b/client/src/app/shared/shared-main/buttons/copy-button.component.ts
new file mode 100644
index 000000000..aac9ab8b0
--- /dev/null
+++ b/client/src/app/shared/shared-main/buttons/copy-button.component.ts
@@ -0,0 +1,22 @@
1import { Component, Input } from '@angular/core'
2import { Notifier } from '@app/core'
3
4@Component({
5 selector: 'my-copy-button',
6 styleUrls: [ './copy-button.component.scss' ],
7 templateUrl: './copy-button.component.html'
8})
9export class CopyButtonComponent {
10 @Input() value: string
11 @Input() title: string
12 @Input() notification: string
13 @Input() isInputGroup = false
14
15 constructor (private notifier: Notifier) {
16
17 }
18
19 activateCopiedMessage () {
20 if (this.notification) this.notifier.success(this.notification)
21 }
22}
diff --git a/client/src/app/shared/shared-main/buttons/index.ts b/client/src/app/shared/shared-main/buttons/index.ts
index 775a47a39..75efbdea3 100644
--- a/client/src/app/shared/shared-main/buttons/index.ts
+++ b/client/src/app/shared/shared-main/buttons/index.ts
@@ -1,4 +1,5 @@
1export * from './action-dropdown.component' 1export * from './action-dropdown.component'
2export * from './button.component' 2export * from './button.component'
3export * from './copy-button.component'
3export * from './delete-button.component' 4export * from './delete-button.component'
4export * from './edit-button.component' 5export * from './edit-button.component'