From a6fc71914543e688640d1853c8ad59c31cdccb8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 9 Jan 2019 04:44:05 +0000 Subject: [PATCH 1/5] Bump cookie-universal-nuxt from 2.0.12 to 2.0.14 Bumps [cookie-universal-nuxt](https://github.com/microcipcip/cookie-universal) from 2.0.12 to 2.0.14. - [Release notes](https://github.com/microcipcip/cookie-universal/releases) - [Commits](https://github.com/microcipcip/cookie-universal/compare/v2.0.12...v2.0.14) Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index f316df396..a60c6f4a3 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@nuxtjs/axios": "^5.3.6", "@nuxtjs/dotenv": "^1.3.0", "accounting": "^0.4.1", - "cookie-universal-nuxt": "^2.0.12", + "cookie-universal-nuxt": "^2.0.14", "cross-env": "^5.2.0", "date-fns": "^2.0.0-alpha.26", "express": "^4.16.3", diff --git a/yarn.lock b/yarn.lock index 800a9deff..ecd24a977 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3793,18 +3793,18 @@ cookie-signature@1.0.6: resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" integrity sha1-4wOogrNCzD7oylE6eZmXNNqzriw= -cookie-universal-nuxt@^2.0.12: - version "2.0.12" - resolved "https://registry.yarnpkg.com/cookie-universal-nuxt/-/cookie-universal-nuxt-2.0.12.tgz#061bb1864d2dd010fad1c484ae982da42954bfd9" - integrity sha512-qZu3rOgsDjWqgq9dU+zCQl3RpsZeevI/c6fN+wgTRsQdSe8MSwYWpl+6Pitu0mXgZKVJ8e+JA3s3jDVoXV5szg== +cookie-universal-nuxt@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/cookie-universal-nuxt/-/cookie-universal-nuxt-2.0.14.tgz#6fdf8e928eadd7611c04a57614fe2e29b60eb971" + integrity sha512-ih9Z0Z2K6eLaugTttGCVN85nogKseIFF/dqup3klvYC4mQS3+1IloqBqzTL/N7degBBAols2oppwYNDmaRtVig== dependencies: "@types/cookie" "^0.3.1" - cookie-universal "^2.0.12" + cookie-universal "^2.0.14" -cookie-universal@^2.0.12: - version "2.0.12" - resolved "https://registry.yarnpkg.com/cookie-universal/-/cookie-universal-2.0.12.tgz#3627a56045a84c1c53618d38bd30b278db5633f4" - integrity sha512-/3ch/W145NHVmX2Oenykb3U/Knmu/78JJZxGY2qw28mIr/Ueve6D+A3BySAncvqIgNUy7lIgmAUjf1hV4D4d/A== +cookie-universal@^2.0.14: + version "2.0.14" + resolved "https://registry.yarnpkg.com/cookie-universal/-/cookie-universal-2.0.14.tgz#1b4f27cffccfc2e47703fa235c1f67f931213041" + integrity sha512-m6J0DQa4/RQvXhzUG37EY1ynK3Uq1BKzp5hotST9olrzjrRx+B0vNPx7azg0/X0XrYQvL7MMbPXwou8m0BNDwg== dependencies: "@types/cookie" "^0.3.1" cookie "^0.3.1" From a7010d32cfcd275e548f6b06de9ea88b86ec107e Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 10 Jan 2019 09:47:35 +0100 Subject: [PATCH 2/5] Improve Dropdown --- assets/styles/main.scss | 20 ++++++++++++++++++++ components/Dropdown.vue | 21 +++++++++++++++++++++ layouts/blank.vue | 1 + layouts/default.vue | 1 + 4 files changed, 43 insertions(+) diff --git a/assets/styles/main.scss b/assets/styles/main.scss index e9254c4b9..91b040f54 100644 --- a/assets/styles/main.scss +++ b/assets/styles/main.scss @@ -126,3 +126,23 @@ hr { background-color: $color-neutral-80; height: 1px !important; } + +#overlay { + display: block; + opacity: 0; + width: 100%; + height: 100%; + top: 0; + left: 0; + position: fixed; + background: rgba(0, 0, 0, 0.15); + z-index: 99; + pointer-events: none; + transition: opacity 150ms ease-out; + transition-delay: 50ms; + + .dropdown-open & { + opacity: 1; + transition-delay: 0; + } +} diff --git a/components/Dropdown.vue b/components/Dropdown.vue index f47c1cabb..1440170f3 100644 --- a/components/Dropdown.vue +++ b/components/Dropdown.vue @@ -36,6 +36,27 @@ export default { isPopoverOpen: false } }, + watch: { + isPopoverOpen: { + immediate: true, + handler(isOpen) { + console.log('isOpen', isOpen) + try { + if (isOpen) { + setTimeout(() => { + document + .getElementsByTagName('body')[0] + .classList.add('dropdown-open') + }, 10) + } else { + document + .getElementsByTagName('body')[0] + .classList.remove('dropdown-open') + } + } catch (err) {} + } + } + }, beforeDestroy() { clearTimeout(mouseEnterTimer) clearTimeout(mouseLeaveTimer) diff --git a/layouts/blank.vue b/layouts/blank.vue index 23a783ac6..140ec9f6e 100644 --- a/layouts/blank.vue +++ b/layouts/blank.vue @@ -5,6 +5,7 @@ +
diff --git a/layouts/default.vue b/layouts/default.vue index 6bf42691e..e38eaeda8 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -72,6 +72,7 @@ +
From 78978e9bdba43e01287c041b497cdb8513d5a94b Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 10 Jan 2019 10:29:02 +0100 Subject: [PATCH 3/5] Added disabled, isOpen, openMenu, closeMenu to Dropdown --- components/Dropdown.vue | 60 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/components/Dropdown.vue b/components/Dropdown.vue index 1440170f3..d354dd257 100644 --- a/components/Dropdown.vue +++ b/components/Dropdown.vue @@ -3,10 +3,16 @@ :open.sync="isPopoverOpen" :open-group="Math.random().toString()" :placement="placement" + :disabled="disabled" trigger="manual" :offset="offset" > - +
@@ -29,6 +38,7 @@ let mouseLeaveTimer = null export default { props: { placement: { type: String, default: 'bottom-end' }, + disabled: { type: Boolean, default: false }, offset: { type: [String, Number], default: '16' } }, data() { @@ -36,6 +46,11 @@ export default { isPopoverOpen: false } }, + computed: { + isOpen() { + return this.isPopoverOpen + } + }, watch: { isPopoverOpen: { immediate: true, @@ -43,11 +58,13 @@ export default { console.log('isOpen', isOpen) try { if (isOpen) { - setTimeout(() => { - document - .getElementsByTagName('body')[0] - .classList.add('dropdown-open') - }, 10) + this.$nextTick(() => { + setTimeout(() => { + document + .getElementsByTagName('body')[0] + .classList.add('dropdown-open') + }, 20) + }) } else { document .getElementsByTagName('body')[0] @@ -63,9 +80,37 @@ export default { }, methods: { toggleMenu() { + if (this.disabled) { + return + } + clearTimeout(mouseEnterTimer) + clearTimeout(mouseLeaveTimer) this.isPopoverOpen = !this.isPopoverOpen }, + openMenu(useTimeout) { + if (this.disabled) { + return + } + if (useTimeout) { + this.popoverMouseEnter() + } else { + this.isPopoverOpen = true + } + }, + closeMenu(useTimeout) { + if (this.disabled) { + return + } + if (useTimeout) { + this.popoveMouseLeave() + } else { + this.isPopoverOpen = false + } + }, popoverMouseEnter() { + if (this.disabled) { + return + } clearTimeout(mouseEnterTimer) clearTimeout(mouseLeaveTimer) if (!this.isPopoverOpen) { @@ -75,6 +120,9 @@ export default { } }, popoveMouseLeave() { + if (this.disabled) { + return + } clearTimeout(mouseEnterTimer) clearTimeout(mouseLeaveTimer) if (this.isPopoverOpen) { From e9ac233d6c97b63da4bd9fa7e20f618b1dddf424 Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 10 Jan 2019 10:29:21 +0100 Subject: [PATCH 4/5] Use Dropdown in Author Component --- components/Author.vue | 248 ++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 131 deletions(-) diff --git a/components/Author.vue b/components/Author.vue index 4ad1e6583..377b74b7f 100644 --- a/components/Author.vue +++ b/components/Author.vue @@ -1,127 +1,127 @@ + + @@ -191,4 +166,15 @@ export default { margin-top: -45px; border: #fff 5px solid; } +.author { + white-space: nowrap; + position: relative; + display: flex; + align-items: center; + + &:hover, + &.active { + z-index: 999; + } +} From 4676f5af5c60acc52ea31194c2e1413263b873cd Mon Sep 17 00:00:00 2001 From: Grzegorz Leoniec Date: Thu, 10 Jan 2019 12:01:27 +0100 Subject: [PATCH 5/5] Fixed is-exact usage ofr user menu and optimized Dropdown internals --- components/Dropdown.vue | 24 +++++++++---------- layouts/default.vue | 23 +++++++++++++----- .../components/navigation/Menu/MenuItem.vue | 4 ++++ 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/components/Dropdown.vue b/components/Dropdown.vue index d354dd257..1cfe84c2b 100644 --- a/components/Dropdown.vue +++ b/components/Dropdown.vue @@ -55,7 +55,6 @@ export default { isPopoverOpen: { immediate: true, handler(isOpen) { - console.log('isOpen', isOpen) try { if (isOpen) { this.$nextTick(() => { @@ -80,18 +79,14 @@ export default { }, methods: { toggleMenu() { - if (this.disabled) { - return - } - clearTimeout(mouseEnterTimer) - clearTimeout(mouseLeaveTimer) - this.isPopoverOpen = !this.isPopoverOpen + this.isPopoverOpen ? this.closeMenu(false) : this.openMenu(false) }, openMenu(useTimeout) { if (this.disabled) { return } - if (useTimeout) { + this.clearTimeouts() + if (useTimeout === true) { this.popoverMouseEnter() } else { this.isPopoverOpen = true @@ -101,7 +96,8 @@ export default { if (this.disabled) { return } - if (useTimeout) { + this.clearTimeouts() + if (useTimeout === true) { this.popoveMouseLeave() } else { this.isPopoverOpen = false @@ -111,8 +107,7 @@ export default { if (this.disabled) { return } - clearTimeout(mouseEnterTimer) - clearTimeout(mouseLeaveTimer) + this.clearTimeouts() if (!this.isPopoverOpen) { mouseEnterTimer = setTimeout(() => { this.isPopoverOpen = true @@ -123,13 +118,16 @@ export default { if (this.disabled) { return } - clearTimeout(mouseEnterTimer) - clearTimeout(mouseLeaveTimer) + this.clearTimeouts() if (this.isPopoverOpen) { mouseLeaveTimer = setTimeout(() => { this.isPopoverOpen = false }, 300) } + }, + clearTimeouts() { + clearTimeout(mouseEnterTimer) + clearTimeout(mouseLeaveTimer) } } } diff --git a/layouts/default.vue b/layouts/default.vue index e38eaeda8..f79b00db5 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -26,7 +26,7 @@