Skip to content

Commit

Permalink
fix(banners): account for privacy in snackbar position
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreCat committed Jan 16, 2025
1 parent d7fb1e2 commit e544535
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion website/client/src/components/header/banners/privacy.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div class="banner d-flex align-items-center justify-content-between py-3 px-4">
<div
class="banner d-flex align-items-center justify-content-between py-3 px-4"
id="privacy-banner"
>
<p
class="mr-3 mb-0"
v-html="$t('privacyOverview') + ' ' + $t('learnMorePrivacy')"
Expand Down
9 changes: 9 additions & 0 deletions website/client/src/components/snackbars/notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default {
notificationTopY: '0px',
preventMultipleWatchExecution: false,
eventPromoBannerHeight: null,
privacyBannerHeight: null,
sleepingBannerHeight: null,
warningBannerHeight: null,
};
Expand All @@ -114,6 +115,10 @@ export default {
notificationBannerHeight () {
let scrollPosToCheck = 56;
if (this.privacyBannerHeight) {
scrollPosToCheck += this.privacyBannerHeight;
}
if (this.warningBannerHeight) {
scrollPosToCheck += this.warningBannerHeight;
}
Expand Down Expand Up @@ -164,6 +169,9 @@ export default {
window.addEventListener('scroll', this.updateScrollY, {
passive: true,
});
window.addEventListener('resize', this.updateBannerHeightAndScrollY, {
passive: true,
});
this.$root.$on(EVENTS.BANNER_HEIGHT_UPDATED, () => {
this.updateBannerHeightAndScrollY();
Expand Down Expand Up @@ -339,6 +347,7 @@ export default {
updateBannerHeightAndScrollY () {
this.updateEventBannerHeight();
this.privacyBannerHeight = document.getElementById('privacy-banner').getBoundingClientRect().height;
this.warningBannerHeight = getBannerHeight('chat-warning');
this.sleepingBannerHeight = getBannerHeight('damage-paused');
this.updateScrollY();
Expand Down

0 comments on commit e544535

Please sign in to comment.