Skip to content

Commit

Permalink
Implemented center-card component
Browse files Browse the repository at this point in the history
  • Loading branch information
pimmerks committed Jun 2, 2020
1 parent a142651 commit 1885575
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 46 deletions.
48 changes: 26 additions & 22 deletions src/app/pages/auth/components/login/login.component.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<div class="card">
<div class="card-block">

<h2>Login</h2>

<app-error-alert [error]="error"></app-error-alert>

<form clrForm [formGroup]="loginForm" (ngSubmit)="onSubmit()" clrLayout="horizontal">
<clr-input-container>
<label>Email</label>
<input clrInput placeholder="[email protected]" type="text" formControlName="email" autocomplete="username" />
<clr-control-error>Please provide an email address.</clr-control-error>
</clr-input-container>
<clr-password-container>
<label>Password</label>
<input clrPassword placeholder="Password" formControlName="password" autocomplete="current-password" />
<clr-control-error>Please provide a password.</clr-control-error>
</clr-password-container>
<br />
<button [clrLoading]="loginBtnState" [disabled]="loginForm.invalid" class="btn btn-primary">Login</button>
</form>
<app-center-card>

<div class="card">
<div class="card-block">

<h2>Login</h2>

<app-error-alert [error]="error"></app-error-alert>

<form clrForm [formGroup]="loginForm" (ngSubmit)="onSubmit()" clrLayout="horizontal">
<clr-input-container>
<label>Email</label>
<input clrInput placeholder="[email protected]" type="text" formControlName="email" autocomplete="username" />
<clr-control-error>Please provide an email address.</clr-control-error>
</clr-input-container>
<clr-password-container>
<label>Password</label>
<input clrPassword placeholder="Password" formControlName="password" autocomplete="current-password" />
<clr-control-error>Please provide a password.</clr-control-error>
</clr-password-container>
<br />
<button [clrLoading]="loginBtnState" [disabled]="loginForm.invalid" class="btn btn-primary">Login</button>
</form>

</div>
</div>
</div>

</app-center-card>
50 changes: 26 additions & 24 deletions src/app/pages/auth/components/register/register.component.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
<div class="card">
<div class="card-block">
<app-center-card>
<div class="card">
<div class="card-block">

<h2>Register</h2>
<h2>Register</h2>

<app-error-alert [error]="error"></app-error-alert>
<app-error-alert [error]="error"></app-error-alert>

<form clrForm [formGroup]="registerForm" (ngSubmit)="onSubmit()" clrLayout="horizontal">
<clr-input-container>
<label>Email</label>
<input clrInput placeholder="[email protected]" type="text" formControlName="email" autocomplete="username" />
<clr-control-error>Please provide an email address.</clr-control-error>
</clr-input-container>
<form clrForm [formGroup]="registerForm" (ngSubmit)="onSubmit()" clrLayout="horizontal">
<clr-input-container>
<label>Email</label>
<input clrInput placeholder="[email protected]" type="text" formControlName="email" autocomplete="username" />
<clr-control-error>Please provide an email address.</clr-control-error>
</clr-input-container>

<clr-input-container>
<label>Name</label>
<input clrInput placeholder="John Doe" type="text" formControlName="name" autocomplete="name" />
<clr-control-error>Please provide a name.</clr-control-error>
</clr-input-container>
<clr-input-container>
<label>Name</label>
<input clrInput placeholder="John Doe" type="text" formControlName="name" autocomplete="name" />
<clr-control-error>Please provide a name.</clr-control-error>
</clr-input-container>

<clr-password-container>
<label>Password</label>
<input clrPassword placeholder="Password" formControlName="password" autocomplete="current-password" />
<clr-control-error>Please provide a password.</clr-control-error>
</clr-password-container>
<br />
<button [clrLoading]="registerBtnState" [disabled]="registerForm.invalid" class="btn btn-primary">register</button>
</form>
<clr-password-container>
<label>Password</label>
<input clrPassword placeholder="Password" formControlName="password" autocomplete="current-password" />
<clr-control-error>Please provide a password.</clr-control-error>
</clr-password-container>
<br />
<button [clrLoading]="registerBtnState" [disabled]="registerForm.invalid" class="btn btn-primary">register</button>
</form>

</div>
</div>
</div>
</app-center-card>
13 changes: 13 additions & 0 deletions src/app/shared/components/center-card/center-card.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div class="clr-row">

<div class="clr-col-xl-4 clr-offset-xl-4
clr-col-lg-6 clr-offset-lg-3
clr-col-md-8 clr-offset-md-2">

<ng-content></ng-content>
</div>

</div>



Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { CenterCardComponent } from './center-card.component';

describe('CenterCardComponent', () => {
let component: CenterCardComponent;
let fixture: ComponentFixture<CenterCardComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CenterCardComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(CenterCardComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
12 changes: 12 additions & 0 deletions src/app/shared/components/center-card/center-card.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component, ChangeDetectionStrategy } from '@angular/core';

@Component({
selector: 'app-center-card',
templateUrl: './center-card.component.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CenterCardComponent {

constructor() { }

}

0 comments on commit 1885575

Please sign in to comment.