diff options
Diffstat (limited to 'client/src/app/shared/shared-main/buttons')
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 | |||
4 | button: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 | |||
13 | my-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 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { 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 | }) | ||
9 | export 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 @@ | |||
1 | export * from './action-dropdown.component' | 1 | export * from './action-dropdown.component' |
2 | export * from './button.component' | 2 | export * from './button.component' |
3 | export * from './copy-button.component' | ||
3 | export * from './delete-button.component' | 4 | export * from './delete-button.component' |
4 | export * from './edit-button.component' | 5 | export * from './edit-button.component' |