mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 10:10:30 +08:00
Add overlay scrollbars with custom styling
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
| "danger"
|
||||
| "success"
|
||||
| "outline";
|
||||
innerElement?: HTMLElement;
|
||||
hoverable?: boolean;
|
||||
onclick?: (e: MouseEvent) => void;
|
||||
stylePosition?: string;
|
||||
@@ -33,10 +34,12 @@
|
||||
styleJustifyContent?: string;
|
||||
}
|
||||
|
||||
const {
|
||||
/* eslint-disable prefer-const */
|
||||
let {
|
||||
children,
|
||||
variant,
|
||||
hoverable = false,
|
||||
innerElement = $bindable(),
|
||||
onclick,
|
||||
stylePadding,
|
||||
styleHeight,
|
||||
@@ -257,6 +260,7 @@
|
||||
<div class="p3-2"></div>
|
||||
<div
|
||||
class="p3-3"
|
||||
bind:this={innerElement}
|
||||
style:max-height={styleMaxHeight}
|
||||
style:min-width={styleMinWidth}
|
||||
style:display={styleDisplay}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
|
||||
import { onMount } from "svelte";
|
||||
import { useOverlayScrollbars } from "overlayscrollbars-svelte";
|
||||
|
||||
import { dynamicInterval } from "@app/lib/interval";
|
||||
import { invoke } from "@app/lib/invoke";
|
||||
@@ -20,6 +21,7 @@
|
||||
|
||||
let { notificationCount }: Props = $props();
|
||||
|
||||
let borderComponent: HTMLElement | undefined = $state();
|
||||
let notificationPopoverExpaneded: boolean = $state(false);
|
||||
let buttonActive: boolean = $state(false);
|
||||
|
||||
@@ -29,6 +31,19 @@
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (borderComponent) {
|
||||
const [initialize] = useOverlayScrollbars({
|
||||
options: () => ({
|
||||
scrollbars: { theme: "os-theme-radicle", autoHide: "scroll" },
|
||||
}),
|
||||
defer: true,
|
||||
});
|
||||
|
||||
initialize({ target: borderComponent });
|
||||
}
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
await loadCounter();
|
||||
});
|
||||
@@ -128,6 +143,7 @@
|
||||
|
||||
{#snippet popover()}
|
||||
<Border
|
||||
bind:innerElement={borderComponent}
|
||||
variant="ghost"
|
||||
styleWidth="40rem"
|
||||
stylePadding="1rem"
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div style:z-index="20">
|
||||
<NakedButton
|
||||
styleHeight="2.5rem"
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user