Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
order-management-react
Project
Project
Details
Activity
Releases
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
Ascend
order-management-react
Commits
1a7e862a
Commit
1a7e862a
authored
May 13, 2021
by
Shanelle Valencia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
💄
Change user account to display drawer [
@svalencia
]
parent
5687f1bc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
89 deletions
+85
-89
Nav.tsx
src/components/Nav.tsx
+43
-37
index.css
src/index.css
+17
-3
AccountPage.tsx
src/pages/AccountPage.tsx
+24
-48
MainRouter.tsx
src/router/MainRouter.tsx
+1
-1
No files found.
src/components/Nav.tsx
View file @
1a7e862a
import
React
,
{
useMemo
}
from
'react'
import
React
,
{
useMemo
,
useRef
}
from
'react'
import
{
Link
}
from
'react-router-dom'
import
{
Link
}
from
'react-router-dom'
import
{
useGoogleAuth
}
from
'hooks'
import
{
useGoogleAuth
}
from
'hooks'
import
{
FontAwesomeIcon
}
from
'@fortawesome/react-fontawesome'
import
{
FontAwesomeIcon
}
from
'@fortawesome/react-fontawesome'
import
{
faUser
}
from
'@fortawesome/free-solid-svg-icons'
import
{
faUser
}
from
'@fortawesome/free-solid-svg-icons'
import
{
Box
,
Heading
,
Flex
,
Spacer
,
Button
,
Image
,
Avatar
,
HStack
}
from
"@chakra-ui/react"
import
{
AccountPage
}
from
'pages'
import
{
Box
,
Heading
,
Flex
,
Spacer
,
Button
,
Image
,
Avatar
,
HStack
,
Input
}
from
"@chakra-ui/react"
import
Logo
from
'../img/logo.png'
import
Logo
from
'../img/logo.png'
import
{
Drawer
,
DrawerBody
,
DrawerHeader
,
DrawerOverlay
,
DrawerContent
,
DrawerCloseButton
,
useDisclosure
}
from
"@chakra-ui/react"
const
Nav
=
()
=>
{
const
Nav
=
()
=>
{
const
{
isSignedIn
,
signOut
,
signIn
,
manager
}
=
useGoogleAuth
();
const
{
isSignedIn
,
signOut
,
signIn
,
manager
}
=
useGoogleAuth
();
const
handleAuth
=
()
=>
{
isSignedIn
?
signOut
()
:
signIn
();}
const
handleAuth
=
()
=>
{
isSignedIn
?
signOut
()
:
signIn
();}
const
authLinkText
=
useMemo
(()
=>
isSignedIn
?
"Logout"
:
"Login"
,
[
isSignedIn
]);
const
authLinkText
=
useMemo
(()
=>
isSignedIn
?
"Logout"
:
"Login"
,
[
isSignedIn
]);
const
{
isOpen
,
onOpen
,
onClose
}
=
useDisclosure
();
const
btnRef
=
useRef
<
HTMLButtonElement
>
(
null
);
const
userIcon
=
isSignedIn
?
const
userIcon
=
isSignedIn
?
<
Avatar
name=
{
manager
.
firstName
+
" "
+
manager
.
lastName
}
boxSize=
"40px"
borderRadius=
"full"
src=
{
manager
.
imageUrl
}
alt=
"profile"
/>
:
null
<
Avatar
name=
{
manager
.
firstName
+
" "
+
manager
.
lastName
}
boxSize=
"40px"
borderRadius=
"full"
src=
{
manager
.
imageUrl
}
alt=
"profile"
/>
:
null
return
(
return
(
<
div
>
<
Flex
className=
"header"
>
<
Flex
className=
"header"
>
<
Box
className=
"left-nav"
>
<
Box
className=
"left-nav"
>
<
Link
to=
"/"
><
Image
src=
{
Logo
}
alt=
"project logo"
height=
"110%"
width=
"55%"
/></
Link
>
<
Link
to=
"/"
><
Image
src=
{
Logo
}
alt=
"project logo"
height=
"110%"
width=
"55%"
/></
Link
>
</
Box
>
</
Box
>
<
Spacer
/>
<
Spacer
/>
<
HStack
className=
"right-nav"
spacing=
"1px"
>
<
HStack
className=
"right-nav"
spacing=
"1px"
>
<
Box
><
button
<
Box
><
button
>
// p={2}
// size="sm"
// color="white"
// fontWeight="bold"
// borderRadius="sm"
// bgGradient="linear(to-r, teal.500,blue.500)"
// _hover={{
// bgGradient: "linear(to-r, blue.500, yellow.500)",
// }}
>
<
Link
to=
"/orders"
>
Orders
</
Link
></
button
></
Box
>
<
Link
to=
"/orders"
>
Orders
</
Link
></
button
></
Box
>
<
Box
><
span
>
|
</
span
></
Box
>
<
Box
><
span
>
|
</
span
></
Box
>
<
Box
><
button
<
Box
><
button
onClick=
{
handleAuth
}
>
{
authLinkText
}
</
button
></
Box
>
// p={2}
<
Box
><
button
ref=
{
btnRef
}
onClick=
{
onOpen
}
>
{
userIcon
}
</
button
></
Box
>
// size="sm"
<
Drawer
// color="white"
isOpen=
{
isOpen
}
// fontWeight="bold"
placement=
"right"
// borderRadius="sm"
onClose=
{
onClose
}
// bgGradient="linear(to-r, teal.500,blue.500)"
finalFocusRef=
{
btnRef
}
// _hover={{
>
// bgGradient: "linear(to-r, blue.500, yellow.500)",
<
DrawerOverlay
/>
// }}
<
DrawerContent
>
onClick=
{
handleAuth
}
>
{
authLinkText
}
</
button
></
Box
>
<
DrawerCloseButton
size=
"sm"
/>
<
Box
><
Link
className=
"nav-link"
to=
"/account"
>
{
userIcon
}
</
Link
></
Box
>
<
DrawerHeader
align=
"center"
>
User Account
</
DrawerHeader
>
<
DrawerBody
>
<
AccountPage
/>
</
DrawerBody
>
</
DrawerContent
>
</
Drawer
>
</
HStack
>
</
HStack
>
</
Flex
>
</
Flex
>
</
div
>
)
)
}
}
...
...
src/index.css
View file @
1a7e862a
...
@@ -159,22 +159,36 @@ input[type=text]:focus {
...
@@ -159,22 +159,36 @@ input[type=text]:focus {
.table-header
{
.table-header
{
background-color
:
rgba
(
2
28
,
158
,
67
,
0.5
);
background-color
:
rgba
(
2
36
,
157
,
65
,
0.534
);
color
:
black
;
color
:
black
;
}
}
/* User Drawer */
.account
{
.account
{
padding
:
50px
0
;
padding
:
40px
0
;
border-top
:
1px
solid
rgba
(
68
,
64
,
64
,
0.363
);
border-bottom
:
1px
solid
rgba
(
68
,
64
,
64
,
0.363
);
}
}
/* .user-name {
padding-top: 3.5px;
} */
/* .chakra-stack__divider.css-vhtjkn {
height: -140px;
} */
/* footer */
/* footer */
.footer
{
.footer
{
padding
:
5px
0
;
padding
:
5px
0
;
border-bottom
:
3
px
solid
rgba
(
80
,
76
,
69
,
0.603
);
border-bottom
:
2.5
px
solid
rgba
(
80
,
76
,
69
,
0.603
);
background-color
:
rgba
(
216
,
130
,
32
,
0.404
);
background-color
:
rgba
(
216
,
130
,
32
,
0.404
);
flex-shrink
:
0
;
flex-shrink
:
0
;
font-size
:
12px
;
font-size
:
12px
;
...
...
src/pages/AccountPage.tsx
View file @
1a7e862a
...
@@ -3,55 +3,31 @@ import {useGoogleAuth} from 'hooks'
...
@@ -3,55 +3,31 @@ import {useGoogleAuth} from 'hooks'
const
AccountPage
=
()
=>
{
const
AccountPage
=
()
=>
{
const
{
manager
}
=
useGoogleAuth
();
const
{
manager
}
=
useGoogleAuth
();
return
(
return
(
<
Center
className=
"account"
>
<
VStack
className=
"account"
>
<
Flex
>
<
Box
w=
"170px"
h=
"10"
>
<
Avatar
name=
{
manager
.
firstName
+
" "
+
manager
.
lastName
}
size=
"2xl"
src=
{
manager
.
imageUrl
}
alt=
"profile"
/>
<
Avatar
name=
{
manager
.
firstName
+
" "
+
manager
.
lastName
}
size=
"2xl"
src=
{
manager
.
imageUrl
}
alt=
"profile"
/>
</
Box
>
<
Spacer
/>
<
Box
w=
"270px"
>
<
Box
w=
"270px"
>
<
VStack
<
VStack
divider=
{
<
StackDivider
borderColor=
"gray.200"
/>
}
divider=
{
<
StackDivider
borderColor=
"gray.200"
/>
}
spacing=
{
4
}
spacing=
{
4
}
align=
"stretch
"
align=
"center
"
>
>
<
Box
h=
"40px"
// p={2}
<
Box
h=
"5px"
className=
"user-name"
>
{
manager
.
firstName
}
{
manager
.
lastName
}
</
Box
>
<
Box
h=
"28px"
w=
"280px"
size=
"sm"
size=
"sm"
align=
"center"
color=
"white"
color=
"white"
fontWeight=
"bold"
fontWeight=
"bold"
borderRadius=
"sm
"
borderRadius=
"md
"
bgGradient=
"linear(to-r, teal.500,blue.500)"
bgGradient=
"linear(to-r, teal.500,blue.500)"
// _hover={{
// _hover={{
// bgGradient: "linear(to-r, orange.500, green.500)",
// }}
>
Email:
{
manager
.
email
}
</
Box
>
<
Box
h=
"40px"
size=
"sm"
color=
"white"
fontWeight=
"bold"
borderRadius=
"sm"
bgGradient=
"linear(to-r, blue.500,yellow.500)"
// _hover={{
// bgGradient: "linear(to-r, blue.500, yellow.500)",
// bgGradient: "linear(to-r, blue.500, yellow.500)",
// }}>
// }}
>
First Name:
{
manager
.
firstName
}
>
{
manager
.
email
}
</
Box
>
<
Box
h=
"40px"
size=
"sm"
color=
"white"
fontWeight=
"bold"
borderRadius=
"sm"
bgGradient=
"linear(to-r, teal.500,purple.400)"
// _hover={{
// bgGradient: "linear(to-r, blue.500, yellow.500)",
// }}>
>
Last Name:
{
manager
.
lastName
}
</
Box
>
</
Box
>
</
VStack
>
</
VStack
>
</
Box
>
</
Box
>
</
Flex
>
</
VStack
>
</
Center
>
)
)
}
}
...
...
src/router/MainRouter.tsx
View file @
1a7e862a
...
@@ -15,7 +15,7 @@ const MainRouter: React.FC = () => {
...
@@ -15,7 +15,7 @@ const MainRouter: React.FC = () => {
<
Nav
/>
<
Nav
/>
<
main
className=
"content"
>
<
main
className=
"content"
>
<
Switch
>
<
Switch
>
<
PrivateRoute
path=
"/account"
component=
{
AccountPage
}
/>
{
/* <PrivateRoute path="/account" component={AccountPage} /> */
}
<
PublicRoute
exact
path=
"/"
component=
{
HomePage
}
/>
<
PublicRoute
exact
path=
"/"
component=
{
HomePage
}
/>
<
PrivateRoute
path=
"/orders/:id"
component=
{
OrderShowPage
}
/>
<
PrivateRoute
path=
"/orders/:id"
component=
{
OrderShowPage
}
/>
<
PrivateRoute
path=
"/orders"
component=
{
OrderIndexPage
}
/>
<
PrivateRoute
path=
"/orders"
component=
{
OrderIndexPage
}
/>
...
...
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