Skip to content

Commit

Permalink
feat: 🎸 add basic username registration component
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Spielmann committed Feb 17, 2021
1 parent 7978c2d commit 42d1898
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/formAccordion/FormAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import * as React from 'react';
import { useState } from 'react';
import './formAccordion.styles';
import { FormAccordionItem } from '../formAccordion/FormAccordionItem';
import { RegistrationUsername } from '../registration/RegistrationUsername';

const accordionItemData = [
{
title: 'Bitte wählen Sie Ihren Benutzernamen',
content: null
content: <RegistrationUsername />
},
{
title: 'Bitte wählen Sie Ihr Passwort',
Expand Down
44 changes: 44 additions & 0 deletions src/components/registration/RegistrationUsername.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as React from 'react';
import { useState } from 'react';
import './registrationUsername.styles';
import { translate } from '../../resources/scripts/i18n/translate';
import { InputField, InputFieldItem } from '../inputField/InputField';
import { ReactComponent as PersonIcon } from '../../resources/img/icons/person.svg';

export const RegistrationUsername = () => {
const [username, setUsername] = useState('');

const inputItemUsername: InputFieldItem = {
content: username,
// class: getValidationClassNames(
// !!usernameErrorMessage,
// !!usernameSuccessMessage
// ),
icon: <PersonIcon />,
id: 'username',
// label:
// usernameErrorMessage || usernameSuccessMessage
// ? `${usernameErrorMessage} ${usernameSuccessMessage}`
// : translate('registration.user.label'),
label: translate('registration.user.label'),
infoText: translate('registration.user.infoText'),
maxLength: 30,
name: 'username',
type: 'text'
};

const handleUsernameChange = (event) => {
// validateUsername(event.target.value);
console.log('change user name');
setUsername(event.target.value);
};

return (
<div>
<InputField
item={inputItemUsername}
inputHandle={handleUsernameChange}
/>
</div>
);
};
Empty file.

0 comments on commit 42d1898

Please sign in to comment.