#42 Footer is now only position-fixed when window is not scrollable

This commit is contained in:
Alicia Sykes 2021-06-21 14:31:20 +01:00
parent 6e0449f615
commit 4bf557875b

View File

@ -1,8 +1,8 @@
<template>
<!-- User Footer -->
<footer v-if="text && text !== ''" v-html="text"></footer>
<footer v-if="text && text !== ''" v-html="text" :class="!scrollVisible ? 'fixed' : ''"></footer>
<!-- Default Footer -->
<footer v-else>
<footer v-else :class="!scrollVisible ? 'fixed' : ''">
Developed by <a :href="authorUrl">{{authorName}}</a>.
Licensed under <a :href="licenseUrl">{{license}}</a>
{{ showCopyright? '©': '' }} {{date}}.
@ -23,14 +23,19 @@ export default {
showCopyright: { type: Boolean, default: true },
repoUrl: { type: String, default: 'https://github.com/lissy93/dashy' },
},
data: () => ({
scrollVisible: false,
}),
mounted() {
this.scrollVisible = document.body.clientHeight > window.innerHeight;
},
};
</script>
<style scoped lang="scss">
footer {
position: fixed;
width: 100%;
width: calc(100% - 0.5rem);
bottom: 0;
padding: 0.25rem;
text-align: center;
@ -39,6 +44,7 @@ footer {
background: var(--background-darker);
margin-top: 1.5rem;
border-top: 1px solid var(--outline-color);
&.fixed { position: fixed; }
}
footer a{