Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ecommerce-maven
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
ecommerce-maven
Commits
1c612a8b
Commit
1c612a8b
authored
May 13, 2021
by
Shaphen Pangburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AFP-131 Shaphen Pangburn]: Add cart item count indicator next to cart icon in nav bar
parent
13dbd7d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
15 deletions
+34
-15
header-container.js
ecom-web/src/components/Header/header-container.js
+3
-1
header.css
ecom-web/src/components/Header/header.css
+26
-13
header.js
ecom-web/src/components/Header/header.js
+4
-1
footer.css
ecom-web/src/resources/stylesheets/footer.css
+1
-0
No files found.
ecom-web/src/components/Header/header-container.js
View file @
1c612a8b
import
{
connect
}
from
'react-redux'
;
import
Header
from
'./header'
;
import
{
fetchUserCart
}
from
'../../actions/cart_actions'
;
const
mSTP
=
state
=>
({
user
:
state
.
user
user
:
state
.
user
,
cartLength
:
state
.
cart
.
length
});
const
mDTP
=
dispatch
=>
({
...
...
ecom-web/src/components/Header/header.css
View file @
1c612a8b
/* .order-history-nav,
.products-nav,
#nav-bar-text,
.cart-nav {
padding-left: 10px;
padding-top: 11px;
padding-bottom: 10px;
color: white;
} */
.header-nav
{
padding-left
:
20px
;
box-shadow
:
0px
1px
10px
;
}
/* #nav-home-link {
margin-bottom: 3px;
} */
.nav-bar-text
{
padding
:
13px
20px
0px
;
}
...
...
@@ -34,3 +21,29 @@
margin-right
:
12px
;
opacity
:
0.3
;
}
.cart-link-container
{
position
:
relative
;
}
.ms-auto
{
position
:
relative
;
}
.items-in-cart
{
position
:
absolute
;
right
:
10px
;
top
:
1px
;
padding
:
0px
8px
;
background-color
:
gray
;
border-radius
:
15px
;
cursor
:
pointer
;
/* transition: all 0.5s; */
animation
:
fadeIn
;
animation-duration
:
0.5s
;
}
.no-show
{
display
:
none
;
}
ecom-web/src/components/Header/header.js
View file @
1c612a8b
...
...
@@ -4,7 +4,6 @@ import Navbar from 'react-bootstrap/Navbar'
import
NavDropdown
from
'react-bootstrap/NavDropdown'
import
{
NavLink
}
from
'react-router-dom'
import
Session
from
'../session/session-container'
import
HeaderCart
from
'./header-cart-container'
import
{
LinkContainer
}
from
'react-router-bootstrap'
import
{
AiOutlineShoppingCart
}
from
'react-icons/ai'
...
...
@@ -44,6 +43,10 @@ export default class Header extends Component {
<
LinkContainer
to
=
"/cart"
>
<
Nav
.
Link
to
=
"/cart"
className
=
"cart-link"
id
=
{
this
.
props
.
user
?.
currentUser
?
""
:
"disabled-cart-link"
}
disabled
=
{
!
this
.
props
.
user
?.
currentUser
}
><
AiOutlineShoppingCart
fill
=
"black"
size
=
{
30
}
/></
Nav
.
Link
>
<
/LinkContainer
>
<
LinkContainer
to
=
"/cart"
>
<
Nav
.
Link
to
=
"/cart"
className
=
{
this
.
props
.
cartLength
>
0
?
"items-in-cart"
:
"no-show"
}
>
{
this
.
props
.
cartLength
}
<
/Nav.Link
>
<
/LinkContainer
>
{
/* <span id="items-in-cart">{ this.props.cartLength }</span> */
}
<
/Nav
>
<
/Navbar.Collapse
>
<
/Navbar
>
...
...
ecom-web/src/resources/stylesheets/footer.css
View file @
1c612a8b
...
...
@@ -5,4 +5,5 @@
align-items
:
center
;
background-color
:
#f8f9fa
;
opacity
:
0.4
;
cursor
:
default
;
}
\ 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