-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add error-boundary & error-indicator components (#16)
- Loading branch information
1 parent
03cf22b
commit fd410d2
Showing
20 changed files
with
323 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
23 changes: 14 additions & 9 deletions
23
js_machine_front/src/components/authorization/AuthorizationSignIn.tsx
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,21 +1,26 @@ | ||
import React, { memo } from 'react'; | ||
import { SignInFrom } from 'components/authorization/SignInFrom'; | ||
import { SocialAuth } from 'components/authorization/SocialAuth'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import 'styles/authorizationSignIn.css'; | ||
|
||
interface SignInProps { | ||
signInStyle: string; | ||
signInStyle: string; | ||
} | ||
|
||
export const AuthorizationSignIn: React.FC<SignInProps> = memo((props: SignInProps) => { | ||
export const AuthorizationSignIn: React.FC<SignInProps> = memo( | ||
(props: SignInProps) => { | ||
return ( | ||
<div className="sign-in"> | ||
<div className={`sign-in__wrapper ${props.signInStyle}`}> | ||
<div className="sign-in__title">Вход</div> | ||
<SocialAuth /> | ||
<SignInFrom /> | ||
</div> | ||
<div className="sign-in"> | ||
<div className={`sign-in__wrapper ${props.signInStyle}`}> | ||
<div className="sign-in__title"> | ||
<FormattedMessage id="authorization.signIn" /> | ||
</div> | ||
<SocialAuth /> | ||
<SignInFrom /> | ||
</div> | ||
</div> | ||
); | ||
}); | ||
}, | ||
); |
23 changes: 14 additions & 9 deletions
23
js_machine_front/src/components/authorization/AuthorizationSignUp.tsx
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,21 +1,26 @@ | ||
import React, { memo } from 'react'; | ||
import { SignUpForm } from 'components/authorization/SignUpForm'; | ||
import { SocialAuth } from 'components/authorization/SocialAuth'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import 'styles/authorizationSignUp.css'; | ||
|
||
interface SignUpProps { | ||
signUpStyle: string; | ||
signUpStyle: string; | ||
} | ||
|
||
export const AuthorizationSignUp: React.FC<SignUpProps> = memo((props: SignUpProps) => { | ||
export const AuthorizationSignUp: React.FC<SignUpProps> = memo( | ||
(props: SignUpProps) => { | ||
return ( | ||
<div className="sign-up"> | ||
<div className={`sign-up__wrapper ${props.signUpStyle}`}> | ||
<div className="sign-up__title">Создать аккаунт</div> | ||
<SocialAuth /> | ||
<SignUpForm /> | ||
</div> | ||
<div className="sign-up"> | ||
<div className={`sign-up__wrapper ${props.signUpStyle}`}> | ||
<div className="sign-up__title"> | ||
<FormattedMessage id="authorization.signUp" /> | ||
</div> | ||
<SocialAuth /> | ||
<SignUpForm /> | ||
</div> | ||
</div> | ||
); | ||
}); | ||
}, | ||
); |
20 changes: 15 additions & 5 deletions
20
js_machine_front/src/components/authorization/SignInFrom.tsx
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,13 +1,23 @@ | ||
import React, { memo } from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import 'styles/authForm.css'; | ||
|
||
export const SignInFrom: React.FC = memo(() => { | ||
return ( | ||
<form className="auth-from"> | ||
<div className="auth-form__title">или используйте E-mail для регистрации:</div> | ||
<input className="auth-form__input" type="text" placeholder="E-mail" /> | ||
<input className="auth-form__input" type="password" placeholder="Пароль" /> | ||
<button className="auth-form__btn" type="submit">ВОЙТИ</button> | ||
</form> | ||
<div className="auth-form__title"> | ||
<FormattedMessage id="authorization.signInFormTitle" /> | ||
</div> | ||
<FormattedMessage id="authorization.signInFormEmail" > | ||
{ placeholder => <input className="auth-form__input" type="email" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<FormattedMessage id="authorization.signInFormPassword" > | ||
{placeholder => <input className="auth-form__input" type="password" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<button className="auth-form__btn" type="submit"> | ||
<FormattedMessage id="authorization.signInFormSubmit" /> | ||
</button> | ||
</form > | ||
); | ||
}); |
24 changes: 18 additions & 6 deletions
24
js_machine_front/src/components/authorization/SignUpForm.tsx
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,15 +1,27 @@ | ||
import React, { memo } from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import 'styles/authForm.css'; | ||
|
||
export const SignUpForm: React.FC = memo(() => { | ||
return ( | ||
<form className="auth-from"> | ||
<div className="auth-form__title">или используйте E-mail для регистрации:</div> | ||
<input className="auth-form__input" type="text" placeholder="Фамилия" /> | ||
<input className="auth-form__input" type="text" placeholder="E-mail" /> | ||
<input className="auth-form__input" type="text" placeholder="Имя" /> | ||
<input className="auth-form__input" type="password" placeholder="Пароль" /> | ||
<button className="auth-form__btn" type="submit">ЗАРЕГИСТРИРОВАТЬСЯ</button> | ||
<div className="auth-form__title"><FormattedMessage id="authorization.signUpFormTitle" /></div> | ||
<FormattedMessage id="authorization.signUpFormLastName" > | ||
{ placeholder => <input className="auth-form__input" type="text" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<FormattedMessage id="authorization.signUpFormEmail" > | ||
{ placeholder => <input className="auth-form__input" type="email" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<FormattedMessage id="authorization.signUpFormFirstName" > | ||
{ placeholder => <input className="auth-form__input" type="text" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<FormattedMessage id="authorization.signUpFormPassword" > | ||
{ placeholder => <input className="auth-form__input" type="text" placeholder={placeholder as string}/>} | ||
</FormattedMessage> | ||
<button className="auth-form__btn" type="submit"> | ||
<FormattedMessage id="authorization.signUpFormSubmit" /> | ||
</button> | ||
</form> | ||
); | ||
}); |
Empty file.
26 changes: 26 additions & 0 deletions
26
js_machine_front/src/components/error-boundary/error-boundary.tsx
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,26 @@ | ||
import * as React from 'react'; | ||
|
||
import { ErrorIndicator } from '../error-indicator'; | ||
|
||
interface ErrorBoundaryState { | ||
hasError: boolean; | ||
} | ||
|
||
export class ErrorBoundary extends React.Component<{}, ErrorBoundaryState> { | ||
state: ErrorBoundaryState = { | ||
hasError: false, | ||
}; | ||
|
||
componentDidCatch(): void { | ||
this.setState({ | ||
hasError: true, | ||
}); | ||
} | ||
|
||
render(): React.ReactNode | React.FC { | ||
if (this.state.hasError) { | ||
return <ErrorIndicator />; | ||
} | ||
return this.props.children; | ||
} | ||
} |
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 @@ | ||
export * from './error-boundary'; |
Oops, something went wrong.