From 30bd394f5cb349a20753174e0747c08a8688a88a Mon Sep 17 00:00:00 2001
From: Tom <31515233+Tom4U@users.noreply.github.com>
Date: Thu, 31 Jan 2019 10:23:56 +0100
Subject: [PATCH] feat(action): provide new attributes for link and title
(#1046)
Provides the ability to use a link and title (if icon is set) for action component:
**Using `[routerLink]` with `link` attribute:**
``
**Using `href` for links other than `[routerLink]`:**
``
Closes #814
---
.../components/actions/actions.component.ts | 61 +++++++++++++++----
1 file changed, 48 insertions(+), 13 deletions(-)
diff --git a/src/framework/theme/components/actions/actions.component.ts b/src/framework/theme/components/actions/actions.component.ts
index 5f57f967c5..bbf187c1a7 100644
--- a/src/framework/theme/components/actions/actions.component.ts
+++ b/src/framework/theme/components/actions/actions.component.ts
@@ -4,11 +4,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
-import {
- Component,
- Input,
- HostBinding,
-} from '@angular/core';
+import { Component, HostBinding, Input } from '@angular/core';
import { convertToBoolProperty } from '../helpers';
@@ -18,19 +14,60 @@ import { convertToBoolProperty } from '../helpers';
@Component({
selector: 'nb-action',
template: `
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
`,
})
export class NbActionComponent {
-
@HostBinding('class.disabled') disabledValue: boolean = false;
+ /**
+ * Router link to use
+ * @type string
+ */
+ @Input() link: string;
+
+ /**
+ * Regular HREF link
+ * @type: string
+ */
+ @Input() href: string;
+
+ /**
+ * Optional title for mouseover
+ * @type string
+ */
+ @Input() title: string = '';
+
/**
* Icon class to display
* @type string
@@ -67,7 +104,6 @@ export class NbActionComponent {
* @type string
*/
@Input() badgePosition: string;
-
}
/**
@@ -129,7 +165,6 @@ export class NbActionComponent {
`,
})
export class NbActionsComponent {
-
static readonly SIZE_SMALL = 'small';
static readonly SIZE_MEDIUM = 'medium';
static readonly SIZE_LARGE = 'large';