More work on post registration form
This commit is contained in:
parent
952949b609
commit
8b03454d6f
27 changed files with 247 additions and 51 deletions
11
frontend-reactive/app/components/util/mail-entry.hbs
Normal file
11
frontend-reactive/app/components/util/mail-entry.hbs
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="mail-entry {{@wrapper-classes}}">
|
||||
<label>
|
||||
Email
|
||||
<Input @type="text" @value={{this.args.data.mail}} placeholder="Email address" {{on "change" (fn this.checkMail)}}/>
|
||||
</label>
|
||||
{{#if this.mailOk}}
|
||||
<p class="mail-ok">O</p>
|
||||
{{else}}
|
||||
<p class="mail-error">X</p>
|
||||
{{/if}}
|
||||
</div>
|
27
frontend-reactive/app/components/util/mail-entry.ts
Normal file
27
frontend-reactive/app/components/util/mail-entry.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { action } from '@ember/object'
|
||||
import { map } from '@ember/object/computed'
|
||||
import Component from '@glimmer/component'
|
||||
import { tracked } from '@glimmer/tracking'
|
||||
|
||||
const re = /.+@\S+\.\S+/
|
||||
|
||||
export interface UtilMailEntrySignature {
|
||||
// The arguments accepted by the component
|
||||
Args: {
|
||||
data: { mail: string; valid: boolean }
|
||||
}
|
||||
// Any blocks yielded by the component
|
||||
Blocks: {
|
||||
default: []
|
||||
}
|
||||
// The element to which `...attributes` is applied in the component template
|
||||
Element: null
|
||||
}
|
||||
|
||||
export default class UtilMailEntry extends Component<UtilMailEntrySignature> {
|
||||
@tracked mailOk = this.args.data.valid
|
||||
@action checkMail() {
|
||||
this.args.data.valid = re.test(this.args.data.mail)
|
||||
this.mailOk = this.args.data.valid
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<div class="{{@wrapper-class}}">
|
||||
{{#each @elements as |element|}}
|
||||
{{#each @elements as |element index|}}
|
||||
<RadioButton
|
||||
@value="{{element}}"
|
||||
@groupValue={{@selected}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue