Skip to content

Commit c4c5f67

Browse files
committed
Fix click and hover area in AccountIcon, remove setTimeout
1 parent e03448f commit c4c5f67

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/themes/default/components/core/blocks/Header/AccountIcon.vue

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<template>
2-
<div class="account-icon inline-flex" @click="openMyAccount">
3-
<div class="dropdown" @mouseover="hoverIcon">
4-
<i class="material-icons md-18" @click="gotoAccount">account_circle</i>
5-
<div v-if="currentUser" :class="showDropdown ? 'dropdown-content show-dropdown' : 'dropdown-content'">
2+
<div
3+
class="account-icon inline-flex"
4+
@click="openMyAccount(); gotoAccount();"
5+
@mouseover="showDropdown"
6+
@mouseout="hideDropdown"
7+
>
8+
<div class="dropdown">
9+
<i class="material-icons md-18">account_circle</i>
10+
<div v-if="currentUser" :class="dropdownOpen ? 'dropdown-content show-dropdown' : 'dropdown-content'">
611
<p>You're logged in as {{ currentUser.firstname }}</p>
712
<hr>
813
<div class="section-wrapper">
9-
<router-link class="no-underline" :to="{ name: 'my-account' }" @click="hideDropdown">My account</router-link>
14+
<router-link class="no-underline" :to="{ name: 'my-account' }">My account</router-link>
1015
</div>
1116
<div class="section-wrapper">
1217
<a href="#" class="no-underline" @click="clickLogout">Logout</a>
@@ -22,29 +27,26 @@ import { coreComponent } from 'lib/themes'
2227
export default {
2328
data () {
2429
return {
25-
showDropdown: false,
30+
dropdownOpen: false,
2631
screenWidth: null
2732
}
2833
},
2934
mounted () {
3035
this.screenWidth = window.innerWidth
3136
},
3237
methods: {
33-
hoverIcon () {
38+
showDropdown () {
3439
if (this.currentUser) {
35-
this.showDropdown = true
36-
setTimeout(() => {
37-
this.showDropdown = false
38-
}, 3000)
40+
this.dropdownOpen = true
3941
}
4042
},
43+
hideDropdown () {
44+
this.dropdownOpen = false
45+
},
4146
clickLogout () {
4247
this.logout()
4348
this.hideDropdown()
4449
},
45-
hideDropdown () {
46-
this.showDropdown = false
47-
},
4850
openMyAccount () {
4951
if (this.screenWidth <= 768 && this.currentUser) {
5052
this.$router.push('/my-account')
@@ -56,7 +58,7 @@ export default {
5658
</script>
5759

5860
<style lang="scss" scoped>
59-
@import '../../../../css/global_vars.scss';
61+
@import '~theme/css/global_vars';
6062
6163
.dropdown {
6264
position: relative;
@@ -98,5 +100,5 @@ export default {
98100
}
99101
}
100102
}
101-
}
102-
</style>
103+
}
104+
</style>

0 commit comments

Comments
 (0)