impr: use Fixate component
This commit is contained in:
23 files changed
+66
-63
No files matched your search
@@ -28,7 +28,6 @@
|
||||
{#if icon}
|
||||
<div
|
||||
class={[
|
||||
,
|
||||
iconClass
|
||||
? iconClass
|
||||
: 'bg-slate-100 dark:bg-zinc-900 p-3 rounded-2xl text-primary-900 dark:text-primary-100',
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from 'svelte'
|
||||
|
||||
const placements = {
|
||||
top: 'top-6 lg:top-22',
|
||||
bottom: 'bottom-22 lg:bottom-6',
|
||||
}
|
||||
|
||||
interface Props {
|
||||
placement: keyof typeof placements
|
||||
children?: Snippet
|
||||
}
|
||||
|
||||
let { placement, children }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class={['sticky z-30 mb-0', placements[placement]]}>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -40,7 +40,7 @@
|
||||
class={[
|
||||
'fixed lg:sticky bottom-0 lg:top-0',
|
||||
!dockVisible && 'max-lg:-bottom-24',
|
||||
'max-w-3xl p-4 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0',
|
||||
'max-w-3xl p-3 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0',
|
||||
'w-full z-50 pointer-events-none',
|
||||
]}
|
||||
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
{#snippet prefix()}
|
||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||
{#if icon}
|
||||
<Icon src={icon} size="18" micro />
|
||||
<Icon src={icon} size="20" mini />
|
||||
{:else}
|
||||
{@render customIcon?.({ size: 16, isSelected })}
|
||||
{/if}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
const debounce = (fn: Function, ms = 300) => {
|
||||
let timeoutId: ReturnType<typeof setTimeout>
|
||||
// eslint-disable-next-line
|
||||
return function (this: any, ...args: any[]) {
|
||||
clearTimeout(timeoutId)
|
||||
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
||||
|
||||
Reference in new issue
Block a user