-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds new font. Adds scrollboar notification
- Loading branch information
Showing
4 changed files
with
102 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<template lang="html"> | ||
<transition name="fade"> | ||
<button | ||
class="button scroll-notification" | ||
:class="hasNew ? 'is-warning' : 'is-primary'" | ||
@click="scrollToBottom" | ||
v-show="visible" | ||
> | ||
<span class="icon large"> <i class="fas fa-chevron-down"></i> </span> | ||
</button> | ||
</transition> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ["messages"], | ||
data() { | ||
return { | ||
visible: false, | ||
hasNew: false | ||
}; | ||
}, | ||
mounted() { | ||
document.addEventListener("scroll", this.onScroll, { passive: true }); | ||
setTimeout(() => this.scrollToBottom(), 500); | ||
}, | ||
beforeDestroy() { | ||
document.removeEventListener("scroll", this.onScroll); | ||
}, | ||
methods: { | ||
scrollToBottom() { | ||
this.visible = false; | ||
window.scrollTo(0, document.body.scrollHeight); | ||
}, | ||
onScroll() { | ||
const scrollBottom = document.documentElement.scrollHeight - document.documentElement.clientHeight; | ||
const diff = Math.abs(document.documentElement.scrollTop - scrollBottom); | ||
this.visible = diff > 50; | ||
if (!this.visible) { | ||
this.hasNew = false; | ||
} | ||
} | ||
}, | ||
watch: { | ||
messages(newValue, oldValue) { | ||
if (this.visible) { | ||
this.hasNew = true; | ||
} else { | ||
this.scrollToBottom(); | ||
} | ||
} | ||
} | ||
}; | ||
</script> | ||
<style scoped> | ||
.scroll-notification { | ||
position: fixed; | ||
right: 40px; | ||
bottom: 30px; | ||
} | ||
.fade-enter-active, | ||
.fade-leave-active { | ||
transition: opacity 0.15s ease-in; | ||
} | ||
.fade-enter, | ||
.fade-leave-to { | ||
opacity: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<title>Dozzle</title> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" /> | ||
<link href="https://fonts.googleapis.com/css?family=Roboto|Roboto+Mono" rel="stylesheet"> | ||
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script> | ||
</head> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Dozzle</title> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css"> | ||
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script> | ||
</head> | ||
|
||
<body> | ||
<section class="section is-fullwidth"> | ||
<div id="app"></div> | ||
</section> | ||
<script src="/main.js"></script> | ||
</body> | ||
|
||
</html> | ||
<body> | ||
<section class="section is-fullwidth"><div id="app"></div></section> | ||
<script src="/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters