Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
ajs12_shop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Egor Kremnev
ajs12_shop
Commits
ddb7b99c
Commit
ddb7b99c
authored
May 18, 2023
by
Egor Kremnev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename TextInput component to FormElement
parent
19ad45b3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
11 deletions
+10
-11
App.js
front_client/src/App.js
+0
-1
ProductForm.jsx
...client/src/components/Product/ProductForm/ProductForm.jsx
+1
-1
FileInput.jsx
front_client/src/components/UI/Form/FileInput/FileInput.jsx
+0
-0
FomElement.jsx
..._client/src/components/UI/Form/FormElement/FomElement.jsx
+3
-3
Login.jsx
front_client/src/containers/Auth/Login/Login.jsx
+3
-3
Register.jsx
front_client/src/containers/Auth/Register/Register.jsx
+3
-3
No files found.
front_client/src/App.js
View file @
ddb7b99c
import
{
Route
,
Routes
}
from
"react-router-dom"
;
import
{
Route
,
Routes
}
from
"react-router-dom"
;
import
{
LOGIN
,
PRODUCT_ADD
,
PRODUCT_LIST
,
PRODUCT_VIEW
,
REGISTER
}
from
"./constants/routes"
;
import
{
LOGIN
,
PRODUCT_ADD
,
PRODUCT_LIST
,
PRODUCT_VIEW
,
REGISTER
}
from
"./constants/routes"
;
import
Layout
from
"./components/Layout/Layout"
;
import
Layout
from
"./components/Layout/Layout"
;
...
...
front_client/src/components/Product/ProductForm/ProductForm.jsx
View file @
ddb7b99c
import
{
useState
}
from
"react"
;
import
{
useState
}
from
"react"
;
import
{
Button
,
Grid
,
TextField
}
from
"@mui/material"
;
import
{
Button
,
Grid
,
TextField
}
from
"@mui/material"
;
import
FileInput
from
"../../UI/Form/F
ormElement/F
ileInput/FileInput"
;
import
FileInput
from
"../../UI/Form/FileInput/FileInput"
;
const
ProductForm
=
({
createProductHandler
})
=>
{
const
ProductForm
=
({
createProductHandler
})
=>
{
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
...
...
front_client/src/components/UI/Form/F
ormElement/F
ileInput/FileInput.jsx
→
front_client/src/components/UI/Form/FileInput/FileInput.jsx
View file @
ddb7b99c
File moved
front_client/src/components/UI/Form/FormElement/
TextInput/TextInpu
t.jsx
→
front_client/src/components/UI/Form/FormElement/
FomElemen
t.jsx
View file @
ddb7b99c
import
{
Grid
,
TextField
}
from
"@mui/material"
;
import
{
Grid
,
TextField
}
from
"@mui/material"
;
import
PropTypes
from
"prop-types"
;
import
PropTypes
from
"prop-types"
;
const
TextInpu
t
=
({
name
,
label
,
value
,
onChange
,
required
,
error
,
type
})
=>
{
const
FomElemen
t
=
({
name
,
label
,
value
,
onChange
,
required
,
error
,
type
})
=>
{
return
<
Grid
item
xs=
{
12
}
>
return
<
Grid
item
xs=
{
12
}
>
<
TextField
<
TextField
fullWidth
fullWidth
...
@@ -19,7 +19,7 @@ const TextInput = ({name, label, value, onChange, required, error, type}) => {
...
@@ -19,7 +19,7 @@ const TextInput = ({name, label, value, onChange, required, error, type}) => {
</
Grid
>;
</
Grid
>;
};
};
TextInpu
t
.
propTypes
=
{
FomElemen
t
.
propTypes
=
{
name
:
PropTypes
.
string
.
isRequired
,
name
:
PropTypes
.
string
.
isRequired
,
label
:
PropTypes
.
string
.
isRequired
,
label
:
PropTypes
.
string
.
isRequired
,
value
:
PropTypes
.
string
.
isRequired
,
value
:
PropTypes
.
string
.
isRequired
,
...
@@ -29,4 +29,4 @@ TextInput.propTypes = {
...
@@ -29,4 +29,4 @@ TextInput.propTypes = {
onChange
:
PropTypes
.
func
.
isRequired
onChange
:
PropTypes
.
func
.
isRequired
};
};
export
default
TextInpu
t
;
export
default
FomElemen
t
;
front_client/src/containers/Auth/Login/Login.jsx
View file @
ddb7b99c
...
@@ -6,7 +6,7 @@ import {Link as RouterLink, useLocation, useNavigate} from 'react-router-dom';
...
@@ -6,7 +6,7 @@ import {Link as RouterLink, useLocation, useNavigate} from 'react-router-dom';
import
{
REGISTER
}
from
"../../../constants/routes"
;
import
{
REGISTER
}
from
"../../../constants/routes"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
loginUser
}
from
"../../../store/actions/usersActions"
;
import
{
loginUser
}
from
"../../../store/actions/usersActions"
;
import
TextInput
from
"../../../components/UI/Form/FormElement/TextInput/TextInpu
t"
;
import
FomElement
from
"../../../components/UI/Form/FormElement/FomElemen
t"
;
import
{
setLoginError
}
from
"../../../store/services/usersSlice"
;
import
{
setLoginError
}
from
"../../../store/services/usersSlice"
;
const
theme
=
createTheme
();
const
theme
=
createTheme
();
...
@@ -63,14 +63,14 @@ const Login = () => {
...
@@ -63,14 +63,14 @@ const Login = () => {
{
error
&&
<
Alert
severity=
"error"
>
{
error
.
error
}
</
Alert
>
}
{
error
&&
<
Alert
severity=
"error"
>
{
error
.
error
}
</
Alert
>
}
<
Box
component=
"form"
noValidate
onSubmit=
{
handleSubmit
}
sx=
{
{
mt
:
3
}
}
>
<
Box
component=
"form"
noValidate
onSubmit=
{
handleSubmit
}
sx=
{
{
mt
:
3
}
}
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
container
spacing=
{
2
}
>
<
TextInpu
t
<
FomElemen
t
required=
{
true
}
required=
{
true
}
label=
"Username"
label=
"Username"
name=
"username"
name=
"username"
onChange=
{
inputChangeHandler
}
onChange=
{
inputChangeHandler
}
value=
{
state
.
username
}
value=
{
state
.
username
}
/>
/>
<
TextInpu
t
<
FomElemen
t
required=
{
true
}
required=
{
true
}
name=
"password"
name=
"password"
label=
"Password"
label=
"Password"
...
...
front_client/src/containers/Auth/Register/Register.jsx
View file @
ddb7b99c
...
@@ -6,7 +6,7 @@ import {Link as RouterLink, useLocation, useNavigate} from 'react-router-dom';
...
@@ -6,7 +6,7 @@ import {Link as RouterLink, useLocation, useNavigate} from 'react-router-dom';
import
{
LOGIN
}
from
"../../../constants/routes"
;
import
{
LOGIN
}
from
"../../../constants/routes"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
useDispatch
,
useSelector
}
from
"react-redux"
;
import
{
registerUser
}
from
"../../../store/actions/usersActions"
;
import
{
registerUser
}
from
"../../../store/actions/usersActions"
;
import
TextInput
from
"../../../components/UI/Form/FormElement/TextInput/TextInpu
t"
;
import
FomElement
from
"../../../components/UI/Form/FormElement/FomElemen
t"
;
import
{
setRegisterError
}
from
"../../../store/services/usersSlice"
;
import
{
setRegisterError
}
from
"../../../store/services/usersSlice"
;
const
theme
=
createTheme
();
const
theme
=
createTheme
();
...
@@ -66,7 +66,7 @@ const Register = () => {
...
@@ -66,7 +66,7 @@ const Register = () => {
</
Typography
>
</
Typography
>
<
Box
component=
"form"
noValidate
onSubmit=
{
handleSubmit
}
sx=
{
{
mt
:
3
}
}
>
<
Box
component=
"form"
noValidate
onSubmit=
{
handleSubmit
}
sx=
{
{
mt
:
3
}
}
>
<
Grid
container
spacing=
{
2
}
>
<
Grid
container
spacing=
{
2
}
>
<
TextInpu
t
<
FomElemen
t
required=
{
true
}
required=
{
true
}
label=
"Username"
label=
"Username"
name=
"username"
name=
"username"
...
@@ -74,7 +74,7 @@ const Register = () => {
...
@@ -74,7 +74,7 @@ const Register = () => {
value=
{
state
.
username
}
value=
{
state
.
username
}
error=
{
getFieldError
(
'username'
)
}
error=
{
getFieldError
(
'username'
)
}
/>
/>
<
TextInpu
t
<
FomElemen
t
required=
{
true
}
required=
{
true
}
name=
"password"
name=
"password"
label=
"Password"
label=
"Password"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment