Add overlay scrollbars with custom styling

This commit is contained in:
Sebastian Martinez
2025-06-11 19:54:59 +02:00
parent 499a0983ea
commit e246a48b90
8 changed files with 119 additions and 88 deletions
+5 -1
View File
@@ -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}
+16
View File
@@ -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"
+1 -1
View File
@@ -111,7 +111,7 @@
{/if}
</div>
<div>
<div style:z-index="20">
<NakedButton
styleHeight="2.5rem"
variant="ghost"