Skip to content

Commit

Permalink
Refactor #882
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Sep 25, 2023
1 parent e204de3 commit 5e53cef
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 11 deletions.
11 changes: 8 additions & 3 deletions assets/styles/layout/_news.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
left: 0;
z-index: 1100;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
height: 2rem;
padding: 0 2rem;

.layout-news-container {
display: flex;
justify-content: space-between;
align-items: center;
width: calc(100% - var(--scrollbar-width, 0px));
height: 100%;
}

.layout-news-content {
flex: 1;
display: flex;
Expand Down
1 change: 1 addition & 0 deletions assets/styles/layout/_responsive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@

.blocked-scroll {
overflow: hidden;
padding-right: var(--scrollbar-width);
}
}

Expand Down
3 changes: 2 additions & 1 deletion assets/styles/layout/_topbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
transition: background-color 1s;

.layout-topbar-inner {
height: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 4rem;
height: 100%;
width: calc(100% - var(--scrollbar-width, 0px));
}

&.layout-topbar-sticky {
Expand Down
2 changes: 2 additions & 0 deletions components/lib/blockui/BlockUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default {
document.body.appendChild(this.mask);
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
document.activeElement.blur();
} else {
this.mask = DomHandler.createElement('div', {
Expand Down Expand Up @@ -92,6 +93,7 @@ export default {
if (this.fullScreen) {
document.body.removeChild(this.mask);
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
} else {
this.$refs.container.removeChild(this.mask);
}
Expand Down
2 changes: 2 additions & 0 deletions components/lib/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,7 @@ export default {
document.body.appendChild(this.mask);
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
}
},
disableModality() {
Expand Down Expand Up @@ -1683,6 +1684,7 @@ export default {
if (!hasBlockerMasks) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
}
},
updateCurrentMetaData() {
Expand Down
2 changes: 2 additions & 0 deletions components/lib/dialog/Dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,10 @@ export default {
if (!this.modal) {
if (this.maximized) {
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
} else {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions components/lib/galleria/Galleria.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default {
beforeUnmount() {
if (this.fullScreen) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
}
this.mask = null;
Expand All @@ -52,6 +53,7 @@ export default {
onEnter(el) {
this.mask.style.zIndex = String(parseInt(el.style.zIndex, 10) - 1);
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
this.focus();
},
onBeforeLeave() {
Expand All @@ -61,6 +63,7 @@ export default {
ZIndexUtils.clear(el);
this.containerVisible = false;
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
},
onActiveItemChange(index) {
if (this.activeIndex !== index) {
Expand Down
3 changes: 3 additions & 0 deletions components/lib/image/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export default {
onImageClick() {
if (this.preview) {
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
this.maskVisible = true;
setTimeout(() => {
this.previewVisible = true;
Expand Down Expand Up @@ -164,6 +165,7 @@ export default {
},
onLeave() {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
this.$emit('hide');
},
onAfterLeave(el) {
Expand All @@ -182,6 +184,7 @@ export default {
this.rotate = 0;
this.scale = 1;
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
}
},
computed: {
Expand Down
2 changes: 2 additions & 0 deletions components/lib/sidebar/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ export default {
if (this.blockScroll) {
DomHandler.addClass(document.body, 'p-overflow-hidden');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
}
},
disableDocumentSettings() {
this.unbindOutsideClickListener();
if (this.blockScroll) {
DomHandler.removeClass(document.body, 'p-overflow-hidden');
document.body.style.removeProperty('--scrollbar-width');
}
},
onKeydown(event) {
Expand Down
16 changes: 9 additions & 7 deletions layouts/AppNews.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<template>
<div class="layout-news" :style="$appState.announcement.backgroundStyle">
<i></i>
<div class="layout-news-content">
<span class="layout-news-text" :style="$appState.announcement.textStyle">{{ $appState.announcement.content }}</span>
<a class="layout-news-link" :href="$appState.announcement.linkHref">{{ $appState.announcement.linkText }}</a>
<div class="layout-news-container">
<i></i>
<div class="layout-news-content">
<span class="layout-news-text" :style="$appState.announcement.textStyle">{{ $appState.announcement.content }}</span>
<a class="layout-news-link" :href="$appState.announcement.linkHref">{{ $appState.announcement.linkText }}</a>
</div>
<a class="layout-news-close" :style="$appState.announcement.textStyle" @click="onClose">
<span class="pi pi-times"></span>
</a>
</div>
<a class="layout-news-close" :style="$appState.announcement.textStyle" @click="onClose">
<span class="pi pi-times"></span>
</a>
</div>
</template>

Expand Down
4 changes: 4 additions & 0 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default {
this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
document.body.style.removeProperty('--scrollbar-width');
this.$toast.removeAllGroups();
}
}
Expand All @@ -61,14 +62,17 @@ export default {
if (this.sidebarActive) {
this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
document.body.style.removeProperty('--scrollbar-width');
} else {
this.sidebarActive = true;
DomHandler.addClass(document.body, 'blocked-scroll');
document.body.style.setProperty('--scrollbar-width', DomHandler.calculateScrollbarWidth() + 'px');
}
},
onMaskClick() {
this.sidebarActive = false;
DomHandler.removeClass(document.body, 'blocked-scroll');
document.body.style.removeProperty('--scrollbar-width');
},
hideNews(event) {
this.$appState.newsActive = false;
Expand Down

0 comments on commit 5e53cef

Please sign in to comment.