Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
red-giant
dashboard
Commits
75c7daa5
Verified
Commit
75c7daa5
authored
3 years ago
by
Defendi Alberto
Browse files
Options
Downloads
Patches
Plain Diff
Move TextInput to InputField
parent
c6202a26
No related branches found
No related tags found
2 merge requests
!17
Axios
,
!13
Basic form api and implement cookie entrypoint
Pipeline
#11632
failed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/AuthUser/SignInForm/InputField.tsx
+28
-0
28 additions, 0 deletions
src/components/AuthUser/SignInForm/InputField.tsx
src/components/AuthUser/SignInForm/SignInForm.tsx
+8
-21
8 additions, 21 deletions
src/components/AuthUser/SignInForm/SignInForm.tsx
with
36 additions
and
21 deletions
src/components/AuthUser/SignInForm/InputField.tsx
0 → 100644
+
28
−
0
View file @
75c7daa5
import
React
,
{
FC
}
from
'
react
'
;
import
{
TextField
}
from
'
@material-ui/core
'
;
type
Props
=
{
id
:
string
;
label
:
string
;
error
:
boolean
;
errorMessage
:
string
;
};
export
const
InputField
:
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
id
,
label
,
error
,
errorMessage
}
=
props
;
return
(
<
TextField
variant
=
"outlined"
margin
=
"normal"
required
fullWidth
id
=
{
id
}
label
=
{
label
}
name
=
{
id
}
autoComplete
=
{
id
}
autoFocus
error
=
{
error
}
helperText
=
{
error
&&
errorMessage
}
/>
);
};
This diff is collapsed.
Click to expand it.
src/components/AuthUser/SignInForm/SignInForm.tsx
+
8
−
21
View file @
75c7daa5
import
React
,
{
FC
}
from
'
react
'
;
import
React
,
{
FC
}
from
'
react
'
;
import
{
useForm
,
Controller
}
from
'
react-hook-form
'
;
import
{
useForm
,
Controller
,
appendErrors
}
from
'
react-hook-form
'
;
import
{
createStyles
,
makeStyles
,
Theme
}
from
'
@material-ui/core/styles
'
;
import
{
createStyles
,
makeStyles
,
Theme
}
from
'
@material-ui/core/styles
'
;
import
{
TextField
,
Button
}
from
'
@material-ui/core
'
;
import
{
TextField
,
Button
}
from
'
@material-ui/core
'
;
import
{
DevTool
}
from
'
@hookform/devtools
'
;
import
{
DevTool
}
from
'
@hookform/devtools
'
;
import
{
InputField
}
from
'
./InputField
'
;
const
useStyles
=
makeStyles
((
theme
:
Theme
)
=>
const
useStyles
=
makeStyles
((
theme
:
Theme
)
=>
createStyles
({
createStyles
({
...
@@ -20,6 +21,7 @@ const useStyles = makeStyles((theme: Theme) =>
...
@@ -20,6 +21,7 @@ const useStyles = makeStyles((theme: Theme) =>
},
},
}),
}),
);
);
// TODO: real time form validation
// TODO: real time form validation
export
const
SignInForm
:
FC
=
()
=>
{
export
const
SignInForm
:
FC
=
()
=>
{
interface
FormData
{
interface
FormData
{
...
@@ -57,18 +59,11 @@ export const SignInForm: FC = () => {
...
@@ -57,18 +59,11 @@ export const SignInForm: FC = () => {
required
:
{
value
:
true
,
message
:
'
You must enter your email
'
},
required
:
{
value
:
true
,
message
:
'
You must enter your email
'
},
}
}
}
}
render
=
{
()
=>
(
render
=
{
()
=>
(
<
TextField
<
InputField
variant
=
"outlined"
margin
=
"normal"
required
fullWidth
id
=
"email"
id
=
"email"
label
=
"Email Address"
label
=
"Email Address"
name
=
"email"
autoComplete
=
"email"
autoFocus
error
=
{
Boolean
(
errors
.
email
)
}
error
=
{
Boolean
(
errors
.
email
)
}
helperText
=
{
errors
.
email
&&
'
Incorrect entry.
'
}
errorMessage
=
"
Incorrect entry.
"
/>
/>
)
}
)
}
/>
/>
...
@@ -83,19 +78,11 @@ export const SignInForm: FC = () => {
...
@@ -83,19 +78,11 @@ export const SignInForm: FC = () => {
required
:
{
value
:
true
,
message
:
'
You must enter your name
'
},
required
:
{
value
:
true
,
message
:
'
You must enter your name
'
},
}
}
}
}
render
=
{
()
=>
(
render
=
{
()
=>
(
<
TextField
<
InputField
variant
=
"outlined"
margin
=
"normal"
required
fullWidth
name
=
"password"
label
=
"Password"
type
=
"password"
id
=
"password"
id
=
"password"
autoComplete
=
"password"
label
=
"Password"
autoFocus
error
=
{
Boolean
(
errors
.
password
)
}
error
=
{
Boolean
(
errors
.
password
)
}
helperText
=
{
errors
.
password
&&
'
Incorrect entry.
'
}
errorMessage
=
"
Incorrect entry.
"
/>
/>
)
}
)
}
/>
/>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment