-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ certif: refacto login form to gjs
- Loading branch information
1 parent
cc202ea
commit f844fc0
Showing
15 changed files
with
314 additions
and
340 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,43 @@ | ||
import PixSelect from '@1024pix/pix-ui/components/pix-select'; | ||
import { service } from '@ember/service'; | ||
import Component from '@glimmer/component'; | ||
import { t } from 'ember-intl'; | ||
import { FRENCH_INTERNATIONAL_LOCALE } from 'pix-certif/services/locale'; | ||
|
||
export default class LanguageSwitcher extends Component { | ||
@service locale; | ||
|
||
get alphabeticallySortedLanguages() { | ||
const availableLanguages = this.locale.getAvailableLanguages(); | ||
|
||
const options = Object.entries(availableLanguages) | ||
.filter(([_, config]) => config.languageSwitcherDisplayed) | ||
.map(([key, config]) => ({ | ||
label: config.value, | ||
value: key, | ||
})); | ||
|
||
const optionsWithoutFrSortedByLabel = options | ||
.filter((option) => option.value !== FRENCH_INTERNATIONAL_LOCALE) | ||
.sort((option) => option.label); | ||
|
||
const frenchLanguageOption = options.find((option) => option.value === FRENCH_INTERNATIONAL_LOCALE); | ||
|
||
return [frenchLanguageOption, ...optionsWithoutFrSortedByLabel]; | ||
} | ||
|
||
<template> | ||
<PixSelect | ||
@id='language-switcher' | ||
@icon='earth-europe' | ||
@value={{@selectedLanguage}} | ||
@options={{this.alphabeticallySortedLanguages}} | ||
@onChange={{@onLanguageChange}} | ||
@hideDefaultOption='true' | ||
@screenReaderOnly='true' | ||
...attributes | ||
> | ||
<:label>{{t 'common.forms.login.choose-language-aria-label'}}</:label> | ||
</PixSelect> | ||
</template> | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,44 @@ | ||
import PixButton from '@1024pix/pix-ui/components/pix-button'; | ||
import PixInput from '@1024pix/pix-ui/components/pix-input'; | ||
import PixInputPassword from '@1024pix/pix-ui/components/pix-input-password'; | ||
import { on } from '@ember/modifier'; | ||
import { t } from 'ember-intl'; | ||
|
||
<template> | ||
<form class='login-main__form' {{on 'submit' @onSubmit}}> | ||
|
||
<p class='login-main-form__mandatory-information'> | ||
{{t 'common.form-errors.mandatory-all-fields'}} | ||
</p> | ||
|
||
<PixInput @id='login-email' name='login' autocomplete='email' type='email' required='true' {{on 'input' @setEmail}}> | ||
<:label>{{t 'common.forms.login.email'}}</:label> | ||
</PixInput> | ||
|
||
<PixInputPassword | ||
@id='login-password' | ||
name='password' | ||
autocomplete='current-password' | ||
required='true' | ||
{{on 'input' @setPassword}} | ||
> | ||
<:label>{{t 'common.forms.login.password'}}</:label> | ||
</PixInputPassword> | ||
|
||
{{#if @isErrorMessagePresent}} | ||
<div class='error-message'> | ||
<p>{{@errorMessage}}</p> | ||
</div> | ||
{{/if}} | ||
|
||
<PixButton @type='submit' class='login-main-form__button'> | ||
{{t 'pages.login.actions.login.label'}} | ||
</PixButton> | ||
|
||
<div class='login-main-form__forgotten-password'> | ||
<a href={{@forgottenPasswordUrl}} target='_blank' rel='noopener noreferrer' class='link'>{{t | ||
'common.forms.login.forgot-password' | ||
}}</a> | ||
</div> | ||
</form> | ||
</template> |
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,21 @@ | ||
import { t } from 'ember-intl'; | ||
|
||
<template> | ||
<header class='login__header'> | ||
<img src='/pix-certif-logo.svg' alt='Pix Certif' /> | ||
|
||
<h1 class='page-title'>{{t 'pages.login.title'}}</h1> | ||
|
||
<p class='login-header__information'> | ||
{{t 'pages.login.accessible-to'}} | ||
</p> | ||
|
||
{{#if @hasInvitationAlreadyBeenAccepted}} | ||
<p class='login-header__invitation-error'>{{t 'pages.login.errors.invitation-already-accepted' htmlSafe=true}}</p> | ||
{{/if}} | ||
|
||
{{#if @isInvitationCancelled}} | ||
<p class='login-header__invitation-error'>{{t 'pages.login.errors.invitation-was-cancelled' htmlSafe=true}}</p> | ||
{{/if}} | ||
</header> | ||
</template> |
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
Oops, something went wrong.