From 237a28cc850da6372b39a34c40d14c24bf92d0f3 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Tue, 6 Jun 2023 15:14:08 +0200 Subject: [PATCH 01/15] collapse subheader with full and floated predictive --- .../desktop-header-floating-predictive.vue | 10 +-- .../desktop-header-full-predictive.vue | 16 +---- src/components/desktop/desktop-sub-header.vue | 69 +++++++++++++++++++ src/components/desktop/desktop.vue | 51 +++++++++++--- .../related-tags-floated-predictive.vue | 19 +++++ .../desktop/related-tags-full-predictive.vue | 19 +++++ 6 files changed, 151 insertions(+), 33 deletions(-) create mode 100644 src/components/desktop/desktop-sub-header.vue create mode 100644 src/components/desktop/related-tags-floated-predictive.vue create mode 100644 src/components/desktop/related-tags-full-predictive.vue diff --git a/src/components/desktop/desktop-header-floating-predictive.vue b/src/components/desktop/desktop-header-floating-predictive.vue index 57fb229c..68ad53b9 100644 --- a/src/components/desktop/desktop-header-floating-predictive.vue +++ b/src/components/desktop/desktop-header-floating-predictive.vue @@ -1,5 +1,5 @@ @@ -32,7 +26,6 @@ import SearchBox from '../search-box.vue'; import Logo from '../logo.vue'; import MaxDesktopWidthItem from '../max-desktop-width-item.vue'; - import { RelatedTags } from '../search'; export default defineComponent({ components: { @@ -42,7 +35,6 @@ Logo, SearchBox, PredictiveLayer, - RelatedTags, LocationProvider } }); diff --git a/src/components/desktop/desktop-header-full-predictive.vue b/src/components/desktop/desktop-header-full-predictive.vue index 6dfdd71c..4ea70fb1 100644 --- a/src/components/desktop/desktop-header-full-predictive.vue +++ b/src/components/desktop/desktop-header-full-predictive.vue @@ -1,5 +1,5 @@ @@ -39,19 +29,15 @@ import Logo from '../logo.vue'; import FullWidthPredictive from '../predictive-layer/full-width-predictive.vue'; import MaxDesktopWidthItem from '../max-desktop-width-item.vue'; - import { RelatedTags } from '../search'; - import DesktopSearchboxAlign from './desktop-searchbox-align.vue'; export default defineComponent({ components: { - DesktopSearchboxAlign, MaxDesktopWidthItem, FullWidthPredictive, CloseMainModal, CrossIcon, Logo, SearchBox, - RelatedTags, LocationProvider } }); diff --git a/src/components/desktop/desktop-sub-header.vue b/src/components/desktop/desktop-sub-header.vue new file mode 100644 index 00000000..f43bb7b8 --- /dev/null +++ b/src/components/desktop/desktop-sub-header.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/desktop/desktop.vue b/src/components/desktop/desktop.vue index 23f6dd8b..ac59d897 100644 --- a/src/components/desktop/desktop.vue +++ b/src/components/desktop/desktop.vue @@ -1,6 +1,17 @@ diff --git a/src/components/desktop/related-tags-floated-predictive.vue b/src/components/desktop/related-tags-floated-predictive.vue new file mode 100644 index 00000000..a14c297b --- /dev/null +++ b/src/components/desktop/related-tags-floated-predictive.vue @@ -0,0 +1,19 @@ + + + diff --git a/src/components/desktop/related-tags-full-predictive.vue b/src/components/desktop/related-tags-full-predictive.vue new file mode 100644 index 00000000..cbaf5b50 --- /dev/null +++ b/src/components/desktop/related-tags-full-predictive.vue @@ -0,0 +1,19 @@ + + + From 422ee488add35012b40851a714ad33b775be4bf9 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Tue, 6 Jun 2023 15:22:59 +0200 Subject: [PATCH 02/15] fix RTs import --- src/components/desktop/desktop-sub-header.vue | 10 +++++----- src/components/desktop/desktop.vue | 2 +- .../desktop/related-tags-floated-predictive.vue | 3 ++- .../desktop/related-tags-full-predictive.vue | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/desktop/desktop-sub-header.vue b/src/components/desktop/desktop-sub-header.vue index f43bb7b8..ec1698b2 100644 --- a/src/components/desktop/desktop-sub-header.vue +++ b/src/components/desktop/desktop-sub-header.vue @@ -4,7 +4,7 @@ >
- +
@@ -19,16 +19,16 @@ diff --git a/src/components/desktop/related-tags-full-predictive.vue b/src/components/desktop/related-tags-full-predictive.vue index cbaf5b50..0fb7689f 100644 --- a/src/components/desktop/related-tags-full-predictive.vue +++ b/src/components/desktop/related-tags-full-predictive.vue @@ -9,11 +9,12 @@ From 165c911c4831cec5b229f51d17fc0e0d6384d191 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Wed, 7 Jun 2023 11:44:59 +0200 Subject: [PATCH 03/15] separate animation from components --- src/components/collapse-heigth-animation.scss | 22 +++++++++++++ src/components/desktop/desktop-sub-header.vue | 23 +------------ src/components/desktop/desktop.vue | 31 +++-------------- src/components/is-scrolling-up.mixin.ts | 33 +++++++++++++++++++ 4 files changed, 61 insertions(+), 48 deletions(-) create mode 100644 src/components/collapse-heigth-animation.scss create mode 100644 src/components/is-scrolling-up.mixin.ts diff --git a/src/components/collapse-heigth-animation.scss b/src/components/collapse-heigth-animation.scss new file mode 100644 index 00000000..2f097195 --- /dev/null +++ b/src/components/collapse-heigth-animation.scss @@ -0,0 +1,22 @@ +.x-layout__sub-header { + display: grid; + grid-template-rows: 0fr; + overflow: hidden; + transition: grid-template-rows 0.35s; +} +.x-layout__sub-header-content { + min-height: 0; + transition: visibility 0.35s; + visibility: hidden; +} + +.x-layout--is-scrolling-up { + .x-layout__sub-header { + grid-template-rows: 1fr; + } +} +.x-layout--is-scrolling-up { + .x-layout__sub-header .x-layout__sub-header-content { + visibility: visible; + } +} \ No newline at end of file diff --git a/src/components/desktop/desktop-sub-header.vue b/src/components/desktop/desktop-sub-header.vue index ec1698b2..036ebb1b 100644 --- a/src/components/desktop/desktop-sub-header.vue +++ b/src/components/desktop/desktop-sub-header.vue @@ -44,26 +44,5 @@ diff --git a/src/components/desktop/desktop.vue b/src/components/desktop/desktop.vue index d7f3c09c..1646abab 100644 --- a/src/components/desktop/desktop.vue +++ b/src/components/desktop/desktop.vue @@ -62,13 +62,7 @@ diff --git a/src/components/is-scrolling-up.mixin.ts b/src/components/is-scrolling-up.mixin.ts new file mode 100644 index 00000000..a3fbb823 --- /dev/null +++ b/src/components/is-scrolling-up.mixin.ts @@ -0,0 +1,33 @@ +import { ScrollDirection, XOn } from '@empathyco/x-components'; +import Vue from 'vue'; +import Component from 'vue-class-component'; +@Component +export default class IsScrollingUp extends Vue { + protected stopScrollDown = true; + protected scroll = true; + protected scrollOffset = 200; + + @XOn('UserChangedScrollDirection') + scrollDirectionChanged(direction: ScrollDirection): void { + this.stopScrollDown = direction === 'UP'; + } + + @XOn(['UserScrolled']) + scrollLength(position: number): void { + if (this.stopScrollDown || position < this.scrollOffset) { + this.scroll = true; + } else if (!this.stopScrollDown && position > this.scrollOffset) { + this.scroll = false; + } + } + + /** + * Checks the direction and the position of the scroll. + * + * @returns True if the user is scrolling up and has scrolled more than + * the defined scrollOffset. + */ + protected get hasScrolled(): boolean { + return this.scroll; + } +} From 75d3c55fbcfd9912bd40e3bf476f00a685c4ca54 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Wed, 7 Jun 2023 13:15:07 +0200 Subject: [PATCH 04/15] fix related tags import --- src/components/desktop/related-tags-full-predictive.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/desktop/related-tags-full-predictive.vue b/src/components/desktop/related-tags-full-predictive.vue index 0fb7689f..c57976fd 100644 --- a/src/components/desktop/related-tags-full-predictive.vue +++ b/src/components/desktop/related-tags-full-predictive.vue @@ -9,8 +9,7 @@ + + diff --git a/src/components/desktop/desktop-sub-header.vue b/src/components/desktop/desktop-sub-header.vue index 036ebb1b..58be3f30 100644 --- a/src/components/desktop/desktop-sub-header.vue +++ b/src/components/desktop/desktop-sub-header.vue @@ -1,10 +1,12 @@ - - diff --git a/src/components/desktop/desktop-top-section.vue b/src/components/desktop/desktop-top-section.vue new file mode 100644 index 00000000..8d578a21 --- /dev/null +++ b/src/components/desktop/desktop-top-section.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/components/desktop/desktop.vue b/src/components/desktop/desktop.vue index 1646abab..b76484e7 100644 --- a/src/components/desktop/desktop.vue +++ b/src/components/desktop/desktop.vue @@ -1,17 +1,6 @@