Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
inventory-promotion-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
inventory-promotion-react
Commits
7fde570f
Commit
7fde570f
authored
May 14, 2021
by
Julius Wu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'uniform-styling' into 'dev'
Uniform styling See merge request
!22
parents
0237d01e
b992e512
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
19 deletions
+81
-19
logo.jpeg
public/logo.jpeg
+0
-0
App.js
src/App.js
+1
-1
Header.jsx
src/component/Header.jsx
+6
-9
ProductIndex.jsx
src/component/ProductIndex.jsx
+1
-1
LoginButton.jsx
src/component/session/LoginButton.jsx
+5
-3
LoginButtonPage.css
src/component/session/LoginButtonPage.css
+2
-1
LogoutButton.jsx
src/component/session/LogoutButton.jsx
+20
-4
LogoutDropDown.css
src/component/session/LogoutDropDown.css
+20
-0
Header.css
src/styles/Header.css
+26
-0
No files found.
public/logo.jpeg
0 → 100644
View file @
7fde570f
148 KB
src/App.js
View file @
7fde570f
...
...
@@ -14,7 +14,7 @@ export const AuthContext = createContext();
function
App
()
{
const
[
isLoggedIn
,
setIsLoggedIn
]
=
useState
(
false
);
const
[
user
,
setUser
]
=
useState
(
null
);
console
.
log
(
user
);
const
state
=
{
user
,
setUser
,
...
...
src/component/Header.jsx
View file @
7fde570f
...
...
@@ -4,14 +4,14 @@ import Search from "./Search";
import
".././styles/Header.css"
import
LogoutButton
from
"./session/LogoutButton"
;
const
Header
=
({
login
,
setLogin
})
=>
{
const
Header
=
({
login
,
setLogin
})
=>
{
const
[
show
,
setShow
]
=
useState
(
false
);
return
(
<
nav
className=
"navbar navbar-expand-lg navbar-dark"
>
<
div
className=
"container-fluid"
>
<
div
id=
"parent"
className=
"container-fluid"
>
<
Link
className=
"navbar-brand"
to=
"/"
>
Ascend
<
img
id=
"logo"
src=
"../../../logo.jpeg"
alt=
"Nisum Logo"
></
img
>
</
Link
>
<
button
className=
"navbar-toggler"
...
...
@@ -30,7 +30,7 @@ const Header = ({login, setLogin}) => {
id=
"navbarSupportedContent"
>
<
ul
className=
"navbar-nav me-auto mb-2 mb-lg-0"
>
<
li
className=
"nav-item"
style=
{
{
color
:
"red"
}
}
>
<
li
className=
"nav-item"
>
<
Link
className=
"nav-link"
to=
"/products"
>
Products
</
Link
>
...
...
@@ -41,11 +41,8 @@ const Header = ({login, setLogin}) => {
</
Link
>
</
li
>
</
ul
>
<
div
id=
"page-title"
className=
"nav-item mx-auto"
>
<
h1
>
Inventory, Promotions, Pricing
</
h1
>
</
div
>
<
LogoutButton
/>
<
h1
id=
"page-title"
>
Inventory, Promotions, Pricing
</
h1
>
<
LogoutButton
/>
</
div
>
</
div
>
</
nav
>
...
...
src/component/ProductIndex.jsx
View file @
7fde570f
...
...
@@ -10,7 +10,7 @@ export default function ProductIndex() {
const
[
categories
,
setCategories
]
=
useState
([]);
const
[
activeCategory
,
setActiveCategory
]
=
useState
(
""
);
console
.
log
(
displayProducts
);
//
console.log(displayProducts);
const
fetchProducts
=
async
()
=>
{
const
res
=
await
fetch
(
`
${
Config
.
inventoryUrl
}
`
);
if
(
res
.
ok
)
{
...
...
src/component/session/LoginButton.jsx
View file @
7fde570f
...
...
@@ -8,13 +8,14 @@ const clientId = `${google_ClientID}.apps.googleusercontent.com`;
function
LoginButton
({}){
const
{
isLoggedIn
,
setIsLoggedIn
}
=
useContext
(
AuthContext
);
const
{
isLoggedIn
,
setIsLoggedIn
,
setUser
}
=
useContext
(
AuthContext
);
const
onSuccessLogin
=
(
res
)
=>
{
setIsLoggedIn
(
true
);
const
{
tokenId
,
profileObj
}
=
res
;
const
{
tokenId
,
profileObj
}
=
res
;
setUser
(
profileObj
);
};
const
onFailure
=
(
res
)
=>
{
setIsLoggedIn
(
false
);
};
...
...
@@ -32,6 +33,7 @@ function LoginButton({}){
onSuccess=
{
onSuccessLogin
}
onFailure=
{
onFailure
}
cookiePolicy=
{
'single_host_origin'
}
isSignedIn=
{
true
}
/>
</
div
>
</
div
>
...
...
src/component/session/LoginButtonPage.css
View file @
7fde570f
...
...
@@ -2,4 +2,5 @@
padding
:
50px
;
justify-content
:
center
;
}
\ No newline at end of file
}
src/component/session/LogoutButton.jsx
View file @
7fde570f
import
React
,
{
useContext
}
from
'react'
;
import
{
GoogleLogout
}
from
'react-google-login'
;
import
{
AuthContext
}
from
"../../App"
;
import
{
Dropdown
}
from
'react-bootstrap'
;
import
"./LogoutDropDown.css"
;
const
google_ClientID
=
process
.
env
.
REACT_APP_GOOGLE_CLIENT_ID
;
const
clientId
=
`
${
google_ClientID
}
.apps.googleusercontent.com`
;
function
LogoutButton
(){
const
{
isLoggedIn
,
setIsLoggedIn
}
=
useContext
(
AuthContext
);
const
{
isLoggedIn
,
setIsLoggedIn
,
user
,
setUser
}
=
useContext
(
AuthContext
);
const
onSuccessLogout
=
(
res
)
=>
{
setIsLoggedIn
(
false
);
...
...
@@ -15,11 +16,26 @@ function LogoutButton(){
return
(
<
div
>
<
GoogleLogout
<
Dropdown
>
<
Dropdown
.
Toggle
className=
"dropdown"
>
{
user
!=
null
?
<
p
><
img
className=
"profile-pic"
src=
{
user
.
imageUrl
}
/>
{
user
.
name
}
</
p
>
:
<
p
>
User
</
p
>
}
</
Dropdown
.
Toggle
>
<
Dropdown
.
Menu
>
<
Dropdown
.
Item
>
Profile
</
Dropdown
.
Item
>
<
Dropdown
.
Item
><
GoogleLogout
render=
{
props
=>
(<
div
onClick=
{
props
.
onClick
}
>
Logout
</
div
>)
}
clientId=
{
clientId
}
buttonText=
"Logout"
onLogoutSuccess=
{
onSuccessLogout
}
/>
isSignedIn=
{
false
}
/></
Dropdown
.
Item
>
</
Dropdown
.
Menu
>
</
Dropdown
>
</
div
>
);
}
...
...
src/component/session/LogoutDropDown.css
0 → 100644
View file @
7fde570f
.profile-pic
{
position
:
relative
;
width
:
28px
;
height
:
28px
;
overflow
:
hidden
;
border-radius
:
50%
;
padding
:
2px
;
}
.dropdown
{
color
:
#EBEBEB
;
background-color
:
transparent
;
}
.dropdown
:hover
{
color
:
#CCCDCF
;
background-color
:
transparent
;
}
src/styles/Header.css
View file @
7fde570f
...
...
@@ -3,5 +3,31 @@
}
#page-title
{
position
:
absolute
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
margin-top
:
auto
;
margin-bottom
:
auto
;
left
:
0
;
right
:
0
;
color
:
#EBEBEB
;
pointer-events
:
none
;
}
#navbarSupportedContent
{
position
:
relative
;
}
#logo
{
width
:
100px
;
height
:
50px
;
}
.nav-link
{
color
:
#EBEBEB
!important
;
}
.nav-link
:hover
{
color
:
#CCCDCF
!important
;
}
\ 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