Skip to content

Commit 76daf1a

Browse files
authored
Merge pull request #141 from ipfs-search/improve-footer#139
Improve footer#139
2 parents 07d9444 + 398b461 commit 76daf1a

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

src/App.vue

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@
99
<router-view />
1010
</v-main>
1111

12-
<!-- This is a replacement for the footer, it'll dissapear on scroll -->
13-
<v-app-bar
14-
padless
15-
color="white"
16-
bottom
17-
fixed
18-
class="hidden-xs-and-down"
19-
hide-on-scroll
20-
scroll-threshold="300"
21-
height="105"
12+
<v-footer
2213
v-if="!(this.$route.name === 'Detail')"
14+
fixed
15+
padless
16+
:class="{ 'footer--hidden': !showFooter }"
2317
>
2418
<v-card
2519
flat
@@ -28,7 +22,7 @@
2822
width="100%"
2923
>
3024
<v-card-text
31-
class="py-1"
25+
class="ipfsPrimary lighten-1 py-1"
3226
>
3327
<v-btn
3428
v-for="(link, i) in footer_links"
@@ -39,11 +33,15 @@
3933
>
4034
<v-icon
4135
:size="$vuetify.breakpoint.smAndUp ? 24 : 18"
36+
color="white"
4237
>
4338
{{ link.icon }}
4439
</v-icon>
4540
</v-btn>
4641
</v-card-text>
42+
<v-divider
43+
class="ipfsPrimary lighten-4"
44+
/>
4745
<v-card-text
4846
class="ipfsPrimary lighten-1 white--text text-center text-caption py-7"
4947
style="margin: auto;"
@@ -63,7 +61,7 @@
6361
</div>
6462
</v-card-text>
6563
</v-card>
66-
</v-app-bar>
64+
</v-footer>
6765
</v-app>
6866
</template>
6967

@@ -75,6 +73,8 @@ export default {
7573
$el: '#app',
7674
7775
data: () => ({
76+
lastScrollPosition: 0,
77+
showFooter: true,
7878
footer_links: [
7979
{
8080
icon: 'mdi-mastodon',
@@ -104,14 +104,34 @@ export default {
104104
const isDark = window.matchMedia('(prefers-color-scheme:dark)').matches;
105105
this.$vuetify.theme.dark = isDark;
106106
},
107+
108+
onScroll() {
109+
const currentScrollPosition = window.pageYOffset || document.documentElement.scrollTop;
110+
if (currentScrollPosition < 0) {
111+
return;
112+
}
113+
// Scroll threshold
114+
if (Math.abs(currentScrollPosition - this.lastScrollPosition) < 300) {
115+
return;
116+
}
117+
this.showFooter = currentScrollPosition < this.lastScrollPosition;
118+
this.lastScrollPosition = currentScrollPosition;
119+
},
120+
107121
},
108122
109123
mounted() {
110124
this.$nextTick(() => {
111125
this.$el.removeAttribute('hidden');
112126
this.setDefaultTheme();
127+
window.addEventListener('scroll', this.onScroll);
113128
});
114129
},
130+
131+
beforeDestroy() {
132+
window.removeEventListener('scroll', this.onScroll);
133+
},
134+
115135
};
116136
</script>
117137

@@ -124,6 +144,13 @@ export default {
124144
font-weight: 500;
125145
}
126146
}
147+
.v-footer {
148+
transform: translate3d(0, 0, 0);
149+
transition: 200ms all ease-in-out;
150+
&.footer--hidden {
151+
transform: translate3d(0, 100%, 0);
152+
}
153+
}
127154
</style>
128155

129156
<style lang="scss">

src/components/AudioPlayer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
class="audio-player"
66
dark
77
bottom
8-
height="98"
8+
height="127"
99
fixed
1010
app
1111
>
1212
<v-card
1313
tile
1414
width="100%"
15-
height="98"
15+
height="127"
1616
style="margin-left: 0 !important;"
1717
>
1818
<v-progress-linear

0 commit comments

Comments
 (0)