Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
concept-front-mojsprat-v2
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
Djordje Mutavdzic
concept-front-mojsprat-v2
Commits
0a67c27a
Commit
0a67c27a
authored
Jun 30, 2022
by
Djordje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Init login page
parent
012f73c6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
10 deletions
+125
-10
App.tsx
src/App.tsx
+3
-2
Form.tsx
src/components/Form.tsx
+26
-0
LoginForm.tsx
src/components/LoginForm.tsx
+85
-3
RegisterForm.tsx
src/components/register/RegisterForm.tsx
+5
-5
internal-types.ts
src/internal-types.ts
+6
-0
No files found.
src/App.tsx
View file @
0a67c27a
...
...
@@ -5,14 +5,15 @@ import { BrowserRouter as Router, Navigate, Route, Routes } from 'react-router-
import
{
EntryPage
}
from
'./components/entry-page/EntryPage'
;
import
{
RegisterForm
}
from
'./components/register/RegisterForm'
;
import
{
LoginForm
}
from
'./components/LoginForm'
;
import
{
Form
}
from
'./components/Form'
;
function
App
()
{
return
(
<
Router
>
<
Routes
>
<
Route
path=
'register/:buildingId'
element=
{
<
EntryPage
children=
{
<
RegisterForm
/>
}
/>
}
/>
<
Route
path=
'register/:buildingId'
element=
{
<
EntryPage
children=
{
<
Form
children=
{
<
RegisterForm
/>
}
title=
"Create Account"
/>
}
/>
}
/>
<
Route
path=
'register/error'
element=
{
<
EntryPage
children=
{
<
div
>
Invalid invitational link - screen to be implemented
</
div
>
}
/>
}
/>
<
Route
path=
'login'
element=
{
<
EntryPage
children=
{
<
LoginForm
/>
}
/>
}
/>
<
Route
path=
'login'
element=
{
<
EntryPage
children=
{
<
Form
children=
{
<
LoginForm
/>
}
title=
"Login"
/>
}
/>
}
/>
<
Route
path=
'*'
element=
{
<
Navigate
replace
to=
"login"
/>
}
/>
</
Routes
>
</
Router
>
...
...
src/components/Form.tsx
0 → 100644
View file @
0a67c27a
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
{
ReactNode
}
from
"react"
;
const
classes
=
{
wrapper
:
{
height
:
'100%'
,
display
:
'flex'
,
flexDirection
:
'column'
,
justifyContent
:
'center'
,
gap
:
'20px'
},
title
:
{
fontFamily
:
'Inter'
,
fontWeight
:
'bold'
,
}
}
as
const
;
export
const
Form
=
({
children
,
title
}:
{
children
?:
ReactNode
,
title
:
string
})
=>
{
return
(
<
Box
style=
{
classes
.
wrapper
}
>
<
Typography
sx=
{
classes
.
title
}
variant=
'h4'
>
{
title
}
</
Typography
>
{
children
}
</
Box
>
);
}
\ No newline at end of file
src/components/LoginForm.tsx
View file @
0a67c27a
import
{
Button
,
TextField
}
from
"@mui/material"
import
{
useState
}
from
"react"
;
import
{
LoginInfo
}
from
"../internal-types"
;
const
classes
=
{
textField
:
{
'& label.Mui-focused'
:
{
color
:
'rgb(30, 41, 60)'
},
'& .MuiOutlinedInput-root'
:
{
'& input'
:
{
zIndex
:
'5'
},
'& fieldset'
:
{
borderColor
:
'rgb(203, 213, 224)'
,
backgroundColor
:
'white'
},
'&:hover fieldset'
:
{
borderColor
:
'rgb(203, 213, 224)'
,
},
'&.Mui-focused'
:
{
'& fieldset'
:
{
borderColor
:
'rgb(203, 213, 224)'
}
},
}
},
select
:
{
'& label.Mui-focused'
:
{
color
:
'red'
}
,
'& fieldset'
:
{
borderColor
:
'rgb(203, 213, 224)'
,
backgroundColor
:
'white'
,
zIndex
:
0
},
'& svg'
:
{
zIndex
:
2
},
'& div'
:
{
zIndex
:
3
},
},
loginButton
:
{
alignSelf
:
'flex-end'
,
'&.MuiButton-root'
:
{
backgroundColor
:
'rgb(19, 71, 175)'
,
borderRadius
:
40
,
padding
:
'10px'
,
paddingInline
:
'25px'
}
}
}
as
const
;
export
const
LoginForm
=
()
=>
{
return
(<
div
>
Hello from LoginForm
</
div
>)
const
[
loginInfo
,
setLoginInfo
]
=
useState
<
LoginInfo
>
({
username
:
''
,
password
:
''
});
return
(
<>
<
TextField
variant=
"outlined"
size=
'small'
label=
"Username"
sx=
{
classes
.
textField
}
value=
{
loginInfo
.
username
}
onChange=
{
(
e
)
=>
{
setLoginInfo
({...
loginInfo
,
username
:
e
.
target
.
value
})
}
}
/>
<
TextField
variant=
"outlined"
size=
'small'
type=
"password"
label=
"Password"
sx=
{
classes
.
textField
}
value=
{
loginInfo
.
password
}
onChange=
{
(
e
)
=>
{
setLoginInfo
({...
loginInfo
,
password
:
e
.
target
.
value
})
}
}
/>
<
Button
sx=
{
classes
.
loginButton
}
variant=
'contained'
>
Login
</
Button
>
</>)
}
\ No newline at end of file
src/components/register/RegisterForm.tsx
View file @
0a67c27a
...
...
@@ -83,10 +83,9 @@ export const RegisterForm = (): JSX.Element => {
return
(
<>
{
invalidUrl
&&
<
Navigate
replace
to=
'../register/error'
/>
}
{
invalidUrl
&&
<
Navigate
replace
to=
'../register/error'
/>
}
{
buildingUnits
&&
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
gap
:
'20px'
}
}
>
<
Typography
sx=
{
{
fontFamily
:
'Inter'
,
fontWeight
:
'bold'
}
}
variant=
'h4'
>
Create Account
</
Typography
>
<
Box
sx=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
gap
:
'20px'
}
}
>
<
Box
sx=
{
{
display
:
'flex'
,
gap
:
'20px'
}
}
>
<
TextField
hiddenLabel
...
...
@@ -161,7 +160,7 @@ export const RegisterForm = (): JSX.Element => {
multiple
onChange=
{
(
e
)
=>
{
let
units
:
string
[]
=
typeof
e
.
target
.
value
===
'string'
?
e
.
target
.
value
.
split
(
','
)
:
e
.
target
.
value
;
setRegisterInfo
({
...
registerInfo
,
units
})
setRegisterInfo
({
...
registerInfo
,
units
})
}
}
>
{
buildingUnits
.
map
((
unit
:
any
,
index
)
=>
<
MenuItem
value=
{
unit
.
address
}
key=
{
index
}
>
{
unit
.
address
}
</
MenuItem
>)
}
...
...
@@ -169,7 +168,7 @@ export const RegisterForm = (): JSX.Element => {
</
FormControl
>
<
Button
sx=
{
classes
.
registerButton
}
variant=
'contained'
>
Register
</
Button
>
</
div
>
</
Box
>
}
</>);
};
\ No newline at end of file
src/internal-types.ts
View file @
0a67c27a
...
...
@@ -6,4 +6,9 @@ export type RegistrationInfo = {
password
:
string
,
mobile
:
string
,
units
:
string
[]
}
export
type
LoginInfo
=
{
username
:
string
,
password
:
string
}
\ No newline at end of file
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