;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ declarations: [NbButtonComponent],
+ });
+
+ fixture = TestBed.createComponent(NbButtonComponent);
+ button = fixture.componentInstance;
+ });
+
+ it('should set class danger', () => {
+ button.status = 'danger';
+ fixture.detectChanges();
+ expect(
+ fixture
+ .debugElement.nativeElement.classList.contains('btn-danger'))
+ .toBeTruthy()
+ });
+
+ it('should set size small', () => {
+ button.size = 'small';
+ fixture.detectChanges();
+ expect(
+ fixture
+ .debugElement.nativeElement.classList.contains('btn-small'))
+ .toBeTruthy()
+ });
+
+ it('should set outline class', () => {
+ button.outline = true;
+ fixture.detectChanges();
+ expect(
+ fixture
+ .debugElement.nativeElement.classList.contains('btn-outline'))
+ .toBeTruthy()
+ });
+
+ it('should set hero class', () => {
+ button.hero = true;
+ fixture.detectChanges();
+ expect(
+ fixture
+ .debugElement.nativeElement.classList.contains('btn-hero'))
+ .toBeTruthy()
+ });
+
+ it('should set shape class', () => {
+ button.shape = 'semi-round';
+ fixture.detectChanges();
+ expect(
+ fixture
+ .debugElement.nativeElement.classList.contains('btn-semi-round'))
+ .toBeTruthy()
+ });
+});
diff --git a/src/framework/theme/index.ts b/src/framework/theme/index.ts
index cc3cff7a0a..a630261dd1 100644
--- a/src/framework/theme/index.ts
+++ b/src/framework/theme/index.ts
@@ -52,3 +52,5 @@ export * from './components/accordion/accordion-item.component';
export * from './components/accordion/accordion-item-body.component';
export * from './components/accordion/accordion-item-header.component';
export * from './components/accordion/accordion.module';
+export * from './components/button/button.component';
+export * from './components/button/button.module';
diff --git a/src/framework/theme/styles/global/_components.scss b/src/framework/theme/styles/global/_components.scss
index c4c3442de2..dcecc85b34 100644
--- a/src/framework/theme/styles/global/_components.scss
+++ b/src/framework/theme/styles/global/_components.scss
@@ -25,6 +25,7 @@
@import '../../components/spinner/spinner.component.theme';
@import '../../components/stepper/stepper.component.theme';
@import '../../components/accordion/accordion.component.theme';
+@import '../../components/button/button.component.theme';
@mixin nb-theme-components() {
@@ -49,4 +50,5 @@
@include nb-alert-theme();
@include nb-chat-theme();
@include nb-accordion-theme();
+ @include nb-buttons-theme();
}
diff --git a/src/framework/theme/styles/global/bootstrap/_size-buttons.scss b/src/framework/theme/styles/global/bootstrap/_size-buttons.scss
index c40c886df5..f15157c4a2 100644
--- a/src/framework/theme/styles/global/bootstrap/_size-buttons.scss
+++ b/src/framework/theme/styles/global/bootstrap/_size-buttons.scss
@@ -17,8 +17,8 @@
@include btn-sm();
}
- .btn.btn-tn {
- @include btn-tn();
+ .btn.btn-xs {
+ @include btn-xs();
}
}
@@ -46,10 +46,10 @@
nb-theme(btn-border-radius));
}
-@mixin btn-tn() {
- @include button-size(nb-theme(btn-padding-y-tn),
- nb-theme(btn-padding-x-tn),
- nb-theme(btn-font-size-tn),
+@mixin btn-xs() {
+ @include button-size(nb-theme(btn-padding-y-xs),
+ nb-theme(btn-padding-x-xs),
+ nb-theme(btn-font-size-xs),
nb-theme(btn-line-height),
nb-theme(btn-border-radius));
}
diff --git a/src/framework/theme/styles/themes/_default.scss b/src/framework/theme/styles/themes/_default.scss
index 0cc0cb54fe..36a82bde59 100644
--- a/src/framework/theme/styles/themes/_default.scss
+++ b/src/framework/theme/styles/themes/_default.scss
@@ -333,9 +333,9 @@ $theme: (
btn-padding-x-sm: 1.5rem,
btn-font-size-sm: 0.875rem,
- btn-padding-y-tn: 0.5rem,
- btn-padding-x-tn: 1.25rem,
- btn-font-size-tn: 0.75rem,
+ btn-padding-y-xs: 0.5rem,
+ btn-padding-x-xs: 1.25rem,
+ btn-font-size-xs: 0.75rem,
btn-border-radius: radius,
btn-rectangle-border-radius: 0.25rem,
diff --git a/src/playground/bootstrap/bootstrap-test.component.ts b/src/playground/bootstrap/bootstrap-test.component.ts
index df99cdbec8..d6c2c65f28 100644
--- a/src/playground/bootstrap/bootstrap-test.component.ts
+++ b/src/playground/bootstrap/bootstrap-test.component.ts
@@ -23,6 +23,12 @@ import { Component } from '@angular/core';
+
+
+
+
+
+
Tables
diff --git a/src/playground/button/button-colors.component.html b/src/playground/button/button-colors.component.html
new file mode 100644
index 0000000000..a4bb13594c
--- /dev/null
+++ b/src/playground/button/button-colors.component.html
@@ -0,0 +1,10 @@
+
+ Button Colors
+
+
+
+
+
+
+
+
diff --git a/src/playground/button/button-colors.component.ts b/src/playground/button/button-colors.component.ts
new file mode 100644
index 0000000000..79effccfa3
--- /dev/null
+++ b/src/playground/button/button-colors.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-colors',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-colors.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonColorsComponent {
+}
diff --git a/src/playground/button/button-hero.component.html b/src/playground/button/button-hero.component.html
new file mode 100644
index 0000000000..c77a081290
--- /dev/null
+++ b/src/playground/button/button-hero.component.html
@@ -0,0 +1,10 @@
+
+ Button Hero
+
+
+
+
+
+
+
+
diff --git a/src/playground/button/button-hero.component.ts b/src/playground/button/button-hero.component.ts
new file mode 100644
index 0000000000..3b181315d0
--- /dev/null
+++ b/src/playground/button/button-hero.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-hero',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-hero.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonHeroComponent {
+}
diff --git a/src/playground/button/button-outline.component.html b/src/playground/button/button-outline.component.html
new file mode 100644
index 0000000000..28b550e6ff
--- /dev/null
+++ b/src/playground/button/button-outline.component.html
@@ -0,0 +1,10 @@
+
+ Button Outline
+
+
+
+
+
+
+
+
diff --git a/src/playground/button/button-outline.component.ts b/src/playground/button/button-outline.component.ts
new file mode 100644
index 0000000000..937a0bc23e
--- /dev/null
+++ b/src/playground/button/button-outline.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-outline',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-outline.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonOutlineComponent {
+}
diff --git a/src/playground/button/button-shapes.component.html b/src/playground/button/button-shapes.component.html
new file mode 100644
index 0000000000..d553949305
--- /dev/null
+++ b/src/playground/button/button-shapes.component.html
@@ -0,0 +1,8 @@
+
+ Button Shapes
+
+
+
+
+
+
diff --git a/src/playground/button/button-shapes.component.ts b/src/playground/button/button-shapes.component.ts
new file mode 100644
index 0000000000..2dca65f05d
--- /dev/null
+++ b/src/playground/button/button-shapes.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-shapes',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-shapes.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonShapesComponent {
+}
diff --git a/src/playground/button/button-showcase.component.html b/src/playground/button/button-showcase.component.html
new file mode 100644
index 0000000000..b8cfc12e7b
--- /dev/null
+++ b/src/playground/button/button-showcase.component.html
@@ -0,0 +1,7 @@
+
+ Button
+
+
+
+
+
diff --git a/src/playground/button/button-showcase.component.ts b/src/playground/button/button-showcase.component.ts
new file mode 100644
index 0000000000..2b84f872a8
--- /dev/null
+++ b/src/playground/button/button-showcase.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-showcase',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-showcase.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 1rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonShowcaseComponent {
+}
diff --git a/src/playground/button/button-sizes.component.html b/src/playground/button/button-sizes.component.html
new file mode 100644
index 0000000000..67e55842db
--- /dev/null
+++ b/src/playground/button/button-sizes.component.html
@@ -0,0 +1,9 @@
+
+ Button Sizes
+
+
+
+
+
+
+
diff --git a/src/playground/button/button-sizes.component.ts b/src/playground/button/button-sizes.component.ts
new file mode 100644
index 0000000000..642605271c
--- /dev/null
+++ b/src/playground/button/button-sizes.component.ts
@@ -0,0 +1,21 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-sizes',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-sizes.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonSizesComponent {
+}
diff --git a/src/playground/button/button-types.component.html b/src/playground/button/button-types.component.html
new file mode 100644
index 0000000000..32fb1820a1
--- /dev/null
+++ b/src/playground/button/button-types.component.html
@@ -0,0 +1,9 @@
+
+ Button Elements
+
+
+
+
+ Link
+
+
diff --git a/src/playground/button/button-types.component.ts b/src/playground/button/button-types.component.ts
new file mode 100644
index 0000000000..8709fcb80e
--- /dev/null
+++ b/src/playground/button/button-types.component.ts
@@ -0,0 +1,26 @@
+/**
+ * @license
+ * Copyright Akveo. All Rights Reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ */
+
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'nb-button-types',
+ changeDetection: ChangeDetectionStrategy.OnPush,
+ templateUrl: './button-types.component.html',
+ styles: [`
+ [nbButton] {
+ margin-right: 0.75rem;
+ margin-bottom: 1rem;
+ }
+ `],
+})
+export class NbButtonTypesComponent {
+
+
+ onClick() {
+ return false;
+ }
+}
diff --git a/src/playground/playground-routing.module.ts b/src/playground/playground-routing.module.ts
index 1954d3e351..f4396ae8ae 100644
--- a/src/playground/playground-routing.module.ts
+++ b/src/playground/playground-routing.module.ts
@@ -125,6 +125,13 @@ import { NbAccordionMultiComponent } from './accordion/accordion-multi.component
import { NbAccordionToggleComponent } from './accordion/accordion-toggle.component';
import { NbLayoutSidebarSubheaderComponent } from './layout/layout-sidebar-subheader.component';
import { NbLayoutSubheaderComponent } from './layout/layout-subheader.component';
+import { NbButtonShowcaseComponent } from './button/button-showcase.component';
+import { NbButtonColorsComponent } from './button/button-colors.component';
+import { NbButtonShapesComponent } from './button/button-shapes.component';
+import { NbButtonHeroComponent } from './button/button-hero.component';
+import { NbButtonOutlineComponent } from './button/button-outline.component';
+import { NbButtonSizesComponent } from './button/button-sizes.component';
+import { NbButtonTypesComponent } from './button/button-types.component';
export const routes: Routes = [
{
@@ -160,6 +167,39 @@ export const routes: Routes = [
},
],
},
+ {
+ path: 'button',
+ children: [
+ {
+ path: 'button-showcase.component',
+ component: NbButtonShowcaseComponent,
+ },
+ {
+ path: 'button-colors.component',
+ component: NbButtonColorsComponent,
+ },
+ {
+ path: 'button-shapes.component',
+ component: NbButtonShapesComponent,
+ },
+ {
+ path: 'button-hero.component',
+ component: NbButtonHeroComponent,
+ },
+ {
+ path: 'button-outline.component',
+ component: NbButtonOutlineComponent,
+ },
+ {
+ path: 'button-sizes.component',
+ component: NbButtonSizesComponent,
+ },
+ {
+ path: 'button-types.component',
+ component: NbButtonTypesComponent,
+ },
+ ],
+ },
{
path: 'checkbox',
children: [
diff --git a/src/playground/playground.module.ts b/src/playground/playground.module.ts
index 300e233b4d..ff042ca4c7 100644
--- a/src/playground/playground.module.ts
+++ b/src/playground/playground.module.ts
@@ -153,6 +153,14 @@ import { NbAccordionToggleComponent } from './accordion/accordion-toggle.compone
import { NbAccordionMultiComponent } from './accordion/accordion-multi.component';
import { NbLayoutSidebarSubheaderComponent } from './layout/layout-sidebar-subheader.component';
import { NbLayoutSubheaderComponent } from './layout/layout-subheader.component';
+import { NbButtonShowcaseComponent } from './button/button-showcase.component';
+import { NbButtonModule } from '@nebular/theme/components/button/button.module';
+import { NbButtonColorsComponent } from './button/button-colors.component';
+import { NbButtonShapesComponent } from './button/button-shapes.component';
+import { NbButtonHeroComponent } from './button/button-hero.component';
+import { NbButtonOutlineComponent } from './button/button-outline.component';
+import { NbButtonSizesComponent } from './button/button-sizes.component';
+import { NbButtonTypesComponent } from './button/button-types.component';
export const NB_MODULES = [
NbCardModule,
@@ -180,6 +188,7 @@ export const NB_MODULES = [
}),
NbSpinnerModule,
NbAccordionModule,
+ NbButtonModule,
];
export const NB_EXAMPLE_COMPONENTS = [
@@ -296,6 +305,13 @@ export const NB_EXAMPLE_COMPONENTS = [
NbAccordionTestComponent,
NbAccordionToggleComponent,
NbAccordionMultiComponent,
+ NbButtonShowcaseComponent,
+ NbButtonColorsComponent,
+ NbButtonShapesComponent,
+ NbButtonHeroComponent,
+ NbButtonOutlineComponent,
+ NbButtonSizesComponent,
+ NbButtonTypesComponent,
];
diff --git a/tslint.json b/tslint.json
index e2df073dab..083ed0be92 100644
--- a/tslint.json
+++ b/tslint.json
@@ -110,9 +110,9 @@
],
"component-selector": [
true,
- "element",
+ ["element", "attribute"],
["nb", "ngd"],
- "kebab-case"
+ ["kebab-case", "camelCase"]
],
"ban": [
true,