2020-01-16 22:14:53 +01:00
|
|
|
import Link from 'next/link';
|
2020-01-14 09:53:40 +01:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
|
import { faUser, faBuilding, faLock } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
|
|
|
|
2020-01-16 22:14:53 +01:00
|
|
|
const UserAuthForm = props => {
|
2020-01-19 23:26:57 +01:00
|
|
|
const isEnterCodeStage = props.authStage === "enterCode";
|
2020-01-16 22:14:53 +01:00
|
|
|
const isRegisterForm = props.formType === "register";
|
2020-01-14 09:53:40 +01:00
|
|
|
const isDeveloperAccount = props.accountType === "developer";
|
|
|
|
const isDeveloperIcon = <span>{isDeveloperAccount ? <FontAwesomeIcon icon={faUser} /> : <FontAwesomeIcon icon={faBuilding} /> }</span>
|
|
|
|
const lockIcon = <span><FontAwesomeIcon icon={faLock} /></span>
|
|
|
|
|
|
|
|
return (
|
2020-01-14 15:23:01 +01:00
|
|
|
<div className="page-content-center">
|
2020-01-19 23:26:57 +01:00
|
|
|
{isRegisterForm ?
|
|
|
|
<h1>Rejestracja konta {isDeveloperAccount ? 'programisty' : 'firmy'} do systemu Task-O!</h1> :
|
|
|
|
<h1>Logowanie do systemu Task-O!</h1>}
|
2020-01-14 09:53:40 +01:00
|
|
|
<form>
|
2020-01-19 23:26:57 +01:00
|
|
|
{isEnterCodeStage &&
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<span><FontAwesomeIcon icon={faLock} /></span>
|
|
|
|
<input type="text" placeholder="Wprowadź kod autoryzacyjny" />
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
}
|
|
|
|
{!isEnterCodeStage &&
|
|
|
|
<ul>
|
|
|
|
{
|
|
|
|
isRegisterForm &&
|
|
|
|
<li>
|
|
|
|
{isDeveloperIcon}
|
|
|
|
<input type="text" placeholder={isDeveloperAccount ? "Podaj imię" : "Podaj nazwę firmy"} />
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
isRegisterForm &&
|
|
|
|
<li>
|
|
|
|
{isDeveloperIcon}
|
|
|
|
<input type="text" placeholder={isDeveloperAccount ? "Podaj nazwisko" : "Podaj numer NIP"}/>
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
<li>
|
|
|
|
{isDeveloperIcon}
|
|
|
|
<input type="email" placeholder="Podaj adres e-mail" />
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
{lockIcon}
|
|
|
|
<input type="password" placeholder="Podaj hasło" />
|
|
|
|
</li>
|
|
|
|
{
|
|
|
|
isRegisterForm &&
|
|
|
|
<li>
|
|
|
|
{lockIcon}
|
|
|
|
<input type="password" placeholder="Powtórz hasło" />
|
|
|
|
</li>
|
|
|
|
}
|
|
|
|
</ul>
|
2020-01-16 22:14:53 +01:00
|
|
|
}
|
2020-01-19 23:26:57 +01:00
|
|
|
{isEnterCodeStage ?
|
|
|
|
<button className="enter-code-stage-button">Zatwierdź</button> :
|
|
|
|
<button className={isRegisterForm ? "register-button" : "login-button"}>{isRegisterForm ? "Zarejestruj się" : "Zaloguj się"}</button>
|
|
|
|
}
|
2020-01-16 22:14:53 +01:00
|
|
|
<Link href={isRegisterForm ? "/login" : "/register"}>
|
|
|
|
<button>{isRegisterForm ? "Zaloguj się" : "Zarejestruj się"}</button>
|
|
|
|
</Link>
|
2020-01-14 09:53:40 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-01-16 22:14:53 +01:00
|
|
|
export default UserAuthForm;
|