Implement Authentication with email + password (#343)

* Implement Login screen ui and add RequireNotAuth guard

* Perform login through auth/password-login flow
This commit is contained in:
Charles Bochet
2023-06-21 04:17:31 +02:00
committed by GitHub
parent e2d8c3a2ec
commit 8790369f72
18 changed files with 288 additions and 76 deletions

View File

@ -1,10 +1,11 @@
import { ChangeEvent, useState } from 'react';
import styled from '@emotion/styled';
type OwnProps = {
value: string;
type OwnProps = Omit<
React.InputHTMLAttributes<HTMLInputElement>,
'onChange'
> & {
onChange?: (text: string) => void;
placeholder?: string;
fullWidth?: boolean;
};
@ -32,8 +33,8 @@ const StyledInput = styled.input<{ fullWidth: boolean }>`
export function TextInput({
value,
onChange,
placeholder,
fullWidth,
...props
}: OwnProps): JSX.Element {
const [internalValue, setInternalValue] = useState(value);
@ -41,13 +42,13 @@ export function TextInput({
<StyledInput
fullWidth={fullWidth ?? false}
value={internalValue}
placeholder={placeholder}
onChange={(event: ChangeEvent<HTMLInputElement>) => {
setInternalValue(event.target.value);
if (onChange) {
onChange(event.target.value);
}
}}
{...props}
/>
);
}