-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
97 additions
and
111 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,6 @@ | ||
{ | ||
"jsxBracketSameLine": true, | ||
"printWidth": 70, | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
} |
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 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
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,50 +1,67 @@ | ||
import React, { ButtonHTMLAttributes, DetailedHTMLProps, InputHTMLAttributes, useState } from 'react'; | ||
import React, { | ||
ButtonHTMLAttributes, | ||
DetailedHTMLProps, | ||
InputHTMLAttributes, | ||
useState, | ||
} from 'react'; | ||
|
||
const Field: React.FC = ({ children }) => | ||
const Field: React.FC = ({ children }) => ( | ||
<> | ||
{children} | ||
<br /> | ||
</>; | ||
</> | ||
); | ||
|
||
type HTMLInputProps = DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>; | ||
type HTMLInputProps = DetailedHTMLProps< | ||
InputHTMLAttributes<HTMLInputElement>, | ||
HTMLInputElement | ||
>; | ||
|
||
type InputProps = Omit<HTMLInputProps, 'onChange'> & { | ||
onChange: (value: string) => void; | ||
} | ||
}; | ||
|
||
const Input = ({ value, onChange, ...props }: InputProps) => | ||
const Input = ({ value, onChange, ...props }: InputProps) => ( | ||
<input | ||
{...props} | ||
value={value} | ||
onChange={event => onChange(event.target.value)} | ||
/>; | ||
onChange={(event) => onChange(event.target.value)} | ||
/> | ||
); | ||
|
||
type ButtonProps = DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> | ||
type ButtonProps = DetailedHTMLProps< | ||
ButtonHTMLAttributes<HTMLButtonElement>, | ||
HTMLButtonElement | ||
>; | ||
|
||
const SubmitButton = (props: ButtonProps) => | ||
<button {...props}>submit</button>; | ||
const SubmitButton = (props: ButtonProps) => ( | ||
<button {...props}>submit</button> | ||
); | ||
|
||
type UserFormProps = { | ||
onSubmit: (email: string, password: string) => void; | ||
} | ||
}; | ||
|
||
const UserForm = ({ | ||
onSubmit, | ||
}: UserFormProps) => { | ||
const [email, setEmail] = useState(""); | ||
const [password, setPassword] = useState(""); | ||
const UserForm = ({ onSubmit }: UserFormProps) => { | ||
const [email, setEmail] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
|
||
return ( | ||
<React.Fragment> | ||
<Field> | ||
email: <Input value={email} onChange={setEmail} /> | ||
</Field> | ||
<Field> | ||
password: <Input value={password} onChange={setPassword} type="password" /> | ||
password:{' '} | ||
<Input | ||
value={password} | ||
onChange={setPassword} | ||
type="password" | ||
/> | ||
</Field> | ||
<SubmitButton onClick={() => onSubmit(email, password)} /> | ||
</React.Fragment> | ||
); | ||
} | ||
}; | ||
|
||
export default UserForm; |
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,10 +1,10 @@ | ||
const firebaseConfig = { | ||
apiKey: "AIzaSyC0hOjv4hqAvG-g7UxItugLuaj-6E2FOjI", | ||
authDomain: "react-firebase-auth-9d938.firebaseapp.com", | ||
databaseURL: "https://react-firebase-auth-9d938.firebaseio.com", | ||
projectId: "react-firebase-auth-9d938", | ||
storageBucket: "react-firebase-auth-9d938.appspot.com", | ||
messagingSenderId: "975967064412" | ||
apiKey: 'AIzaSyC0hOjv4hqAvG-g7UxItugLuaj-6E2FOjI', | ||
authDomain: 'react-firebase-auth-9d938.firebaseapp.com', | ||
databaseURL: 'https://react-firebase-auth-9d938.firebaseio.com', | ||
projectId: 'react-firebase-auth-9d938', | ||
storageBucket: 'react-firebase-auth-9d938.appspot.com', | ||
messagingSenderId: '975967064412', | ||
}; | ||
|
||
export default firebaseConfig; |
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
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