Skip to content

Commit

Permalink
Merge pull request #12 from awcodes/no-overlay-test
Browse files Browse the repository at this point in the history
Fix: overlay issues with notifications
  • Loading branch information
awcodes authored Sep 18, 2022
2 parents c064a5b + 3dd055c commit 58d02e4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
35 changes: 14 additions & 21 deletions resources/css/plugin.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
@tailwind utilities;
.filament-main-topbar::before {
@apply opacity-0;
content: "";
z-index: 5;
}

.is-sticky .filament-main-topbar::before {
@apply opacity-100 h-16 block absolute inset-0 backdrop-blur-md transition-all bg-white/75 border-b border-gray-200 dark:bg-gray-900/75 dark:border-gray-700;
@screen lg {
.filament-sidebar {
z-index: 2 !important;
}
}

.is-sticky .filament-header {
@apply transition-all z-10 min-h-[4rem] py-0 flex items-center space-y-0 sticky top-0;
@apply sticky inset-x-0 md:items-center py-3 md:-inset-x-6;
z-index: 1;
}

.is-sticky .filament-header .filament-header-heading {
@apply text-xl overflow-ellipsis whitespace-nowrap overflow-hidden;
.is-sticky .filament-header:before {
@apply backdrop-blur-md bg-white/95 dark:bg-gray-900/95 border-b border-gray-200 dark:border-gray-700 absolute block top-0 bottom-0;
content: "";
z-index: -1;
left: -1000px;
right: -1000px;
}

[stuck] .filament-header {
margin-inline: -1rem;
padding-inline: theme("spacing.4");
padding-block: theme("spacing.3");
z-index: 20;
min-height: 4rem;
align-items: center;
background-color: theme(colors.white / 75%);
border-color: theme("colors.gray.200");
border-bottom: solid 1px;
backdrop-filter: blur(12px);
.is-sticky .filament-header .filament-header-heading {
@apply text-xl overflow-ellipsis whitespace-nowrap overflow-hidden leading-none;
}
2 changes: 1 addition & 1 deletion resources/dist/filament-sticky-header.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion resources/dist/filament-sticky-header.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions resources/js/plugin.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
const filamentTopbar = document.querySelector(".filament-main-topbar");
const filamentMain = document.querySelector(".filament-main");
const filamentMainContent = document.querySelector(".filament-main-content");
const filamentHeader = document.querySelector(".filament-header");

if (filamentTopbar && filamentMain) {
if (filamentTopbar && filamentMainContent && filamentHeader) {
window.addEventListener("load", function () {
const trigger = document.createElement("div");
trigger.classList.add("filament-sticky-trigger");
filamentTopbar.after(trigger);
filamentMainContent.prepend(trigger);

const observer = new IntersectionObserver(
([e]) => {
if (e.isIntersecting) {
filamentMain.classList.remove("is-sticky");
filamentMainContent.classList.remove("is-sticky");
return;
}

filamentMain.classList.add("is-sticky");
filamentHeader.style.top = filamentTopbar.offsetHeight + "px";
filamentHeader.setAttribute("wire:ignore", true);
filamentMainContent.classList.add("is-sticky");
},
{
rootMargin: `-${filamentTopbar.offsetHeight}px`,
threshold: [0],
}
);
Expand Down

0 comments on commit 58d02e4

Please sign in to comment.