From 2367b3b222251f76e03aa05d4944eaae08973540 Mon Sep 17 00:00:00 2001 From: Dmitry Nehaychik <4dmitr@gmail.com> Date: Fri, 6 Jul 2018 17:34:27 +0300 Subject: [PATCH] feat(auth): add back button --- src/framework/auth/components/auth.component.scss | 10 ++++++++++ src/framework/auth/components/auth.component.ts | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/framework/auth/components/auth.component.scss b/src/framework/auth/components/auth.component.scss index 7a8e694308..836fec7542 100644 --- a/src/framework/auth/components/auth.component.scss +++ b/src/framework/auth/components/auth.component.scss @@ -9,6 +9,16 @@ height: calc(100vh - 2 * #{$auth-layout-padding}); } + nb-card-header { + a { + text-decoration: none; + i { + font-size: 2rem; + font-weight: bold; + } + } + } + nb-card { margin: 0; } diff --git a/src/framework/auth/components/auth.component.ts b/src/framework/auth/components/auth.component.ts index 4e43766ed0..1ba9740970 100644 --- a/src/framework/auth/components/auth.component.ts +++ b/src/framework/auth/components/auth.component.ts @@ -4,6 +4,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. */ import { Component, OnDestroy } from '@angular/core'; +import { Location } from '@angular/common'; + import { NbAuthService } from '../services/auth.service'; import { takeWhile } from 'rxjs/operators'; @@ -14,6 +16,9 @@ import { takeWhile } from 'rxjs/operators'; + + +
@@ -34,7 +39,7 @@ export class NbAuthComponent implements OnDestroy { token: string = ''; // showcase of how to use the onAuthenticationChange method - constructor(protected auth: NbAuthService) { + constructor(protected auth: NbAuthService, protected location: Location) { this.subscription = auth.onAuthenticationChange() .pipe(takeWhile(() => this.alive)) @@ -43,6 +48,11 @@ export class NbAuthComponent implements OnDestroy { }); } + back() { + this.location.back(); + return false; + } + ngOnDestroy(): void { this.alive = false; }