feat: add community header back on press

This commit is contained in:
James Xylight committed 2025-02-16 21:02:45 -08:00
1 parent 9a01df0d36
commit 2edc48b44c
6 files changed
+46 -20

No files matched your search

+11 -1
View File
@@ -32,6 +32,7 @@
interface Props {
openOnHover?: boolean
open?: boolean
autoClose?: boolean
placement?: Placement
middleware?: Middleware[]
strategy?: Strategy
@@ -46,6 +47,7 @@
let {
openOnHover = false,
open = $bindable(false),
autoClose = false,
placement = 'bottom-start',
middleware = [offset(6), shift(), flip()],
strategy = 'fixed',
@@ -60,6 +62,7 @@
let canUseContents = $state(true)
let el: any = $state()
let popoverEl: any = $state()
const [floatingRef, floatingContent] = createFloatingActions({
strategy: strategy,
@@ -90,7 +93,13 @@
if (openOnHover) return
if (!el?.contains(e.target) && open) {
open = false
if (!autoClose) {
if (popoverEl && !popoverEl.contains(e.target)) {
open = false
}
} else {
open = false
}
}
}}
onkeydown={async (e) => {
@@ -128,6 +137,7 @@
class="z-[150] {popoverClass}"
use:customFloatingContent
use:focusTrap
bind:this={popoverEl}
>
{#if popover}{@render popover()}{:else}
<Material elevation="high" color="distinct" class="flex flex-col">