-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement ControlValueAccessor and add proper demo page (0.1.0-beta.0)
- Loading branch information
Showing
14 changed files
with
279 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 0.1.0-beta.0 (2018-10-04) | ||
|
||
## Features | ||
- Implement ControlValueAccessor (allows data binding through ngModel and basic validation) | ||
- Add proper demo page | ||
|
||
## Fixes | ||
- Fix issues with multiple hCaptcha instances | ||
|
||
# 0.0.1 (2018-10-01) | ||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,33 @@ | ||
<!--The content below is only a placeholder and can be replaced.--> | ||
<div> | ||
<h1>ng-hcaptcha Demo</h1> | ||
</div> | ||
|
||
<div class="hcaptcha-wrapper"> | ||
<ng-hcaptcha></ng-hcaptcha> | ||
</div> | ||
<header> | ||
<div class="logo"> | ||
<span class="logo-prefix">ng-</span> | ||
<img src="https://hcaptcha.com/static/img/site/horizontal-logo.svg"> | ||
<span class="logo-suffix">Demo</span> | ||
</div> | ||
|
||
<div class="app-version"> | ||
<span>v{{ appVersion }}</span> | ||
</div> | ||
</header> | ||
|
||
<main> | ||
<form class="demo-form" [formGroup]="signUpForm" (submit)="onSubmit()"> | ||
<div class="form-control"> | ||
<input type="email" placeholder="E-Mail" formControlName="email" [class.error]="!signUpForm.get('email').valid" required> | ||
</div> | ||
|
||
<div class="form-control"> | ||
<input type="password" placeholder="Password" formControlName="password" [class.error]="!signUpForm.get('password').valid" required> | ||
</div> | ||
|
||
<div class="form-control"> | ||
<input type="password" placeholder="Confirm password" formControlName="confirmPassword" [class.error]="!signUpForm.get('confirmPassword').valid" required> | ||
</div> | ||
|
||
<div class="flex justify-content-between"> | ||
<ng-hcaptcha formControlName="captcha"></ng-hcaptcha> | ||
|
||
<button type="submit" class="btn primary signup" [disabled]="!signUpForm.valid">Sign up</button> | ||
</div> | ||
</form> | ||
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,48 @@ | ||
.hcaptcha-wrapper { | ||
border: solid 1px #8d8d8d; | ||
padding: 25px; | ||
header { | ||
width: 100%; | ||
height: 80px; | ||
margin-bottom: 50px; | ||
|
||
.app-version { | ||
position: absolute; | ||
top: 10px; | ||
right: 15px; | ||
opacity: 0.5; | ||
} | ||
} | ||
|
||
.logo { | ||
height: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
span { | ||
font-size: 3.5em; | ||
font-weight: bold; | ||
color: #4a4a4a; | ||
|
||
} | ||
|
||
.logo-prefix { | ||
margin-right: 15px; | ||
} | ||
|
||
.logo-suffix { | ||
margin-left: 15px; | ||
} | ||
|
||
img { | ||
width: auto; | ||
height: 100%; | ||
} | ||
} | ||
|
||
main { | ||
width: 100%; | ||
} | ||
|
||
.demo-form { | ||
width: 30%; | ||
margin: 0 auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,31 @@ | ||
import { Component } from '@angular/core'; | ||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; | ||
import { environment } from '../environments/environment'; | ||
|
||
@Component({ | ||
selector: 'hc-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'] | ||
}) | ||
export class AppComponent { | ||
|
||
appVersion = environment.version; | ||
|
||
signUpForm: FormGroup; | ||
|
||
|
||
constructor(fb: FormBuilder) { | ||
this.signUpForm = fb.group({ | ||
email: ['', Validators.compose([Validators.email, Validators.required])], | ||
password: ['', Validators.required], | ||
confirmPassword: ['', Validators.required], | ||
captcha: ['', Validators.required] | ||
}); | ||
} | ||
|
||
|
||
onSubmit() { | ||
this.signUpForm.reset(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export const environment = { | ||
production: true | ||
production: true, | ||
version: require('../../package.json').version, | ||
siteKey: '6de09d9c-8f26-4501-8141-49f4fa644d38' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.