FloatingButton 컴포넌트 리팩토링

This commit is contained in:
static
2025-01-28 22:53:50 +09:00
parent b6edc2a8bc
commit d2aca276ac
6 changed files with 18 additions and 20 deletions

View File

@@ -5,26 +5,23 @@
interface Props {
icon: Component<SvelteHTMLElements["svg"]>;
offset?: ClassValue;
offset: ClassValue;
onclick?: () => void;
}
let { icon: Icon, offset = "bottom-20", onclick }: Props = $props();
let { icon: Icon, offset, onclick }: Props = $props();
</script>
<div class="pointer-events-none fixed inset-0">
<div class={["absolute w-full", offset]}>
<AdaptiveDiv>
<div class="relative">
<div class="absolute bottom-4 right-4">
<button
onclick={onclick && (() => setTimeout(onclick, 100))}
class="pointer-events-auto flex h-14 w-14 items-center justify-center rounded-full bg-gray-300 shadow-lg transition active:scale-95 active:bg-gray-400"
>
<Icon class="text-xl" />
</button>
</div>
</div>
</AdaptiveDiv>
</div>
<AdaptiveDiv class="relative h-full">
<button
onclick={onclick && (() => setTimeout(onclick, 100))}
class={[
"pointer-events-auto absolute bottom-4 right-4 flex h-14 w-14 items-center justify-center rounded-full bg-gray-300 shadow-lg transition active:scale-95 active:bg-gray-400",
offset,
]}
>
<Icon class="text-xl" />
</button>
</AdaptiveDiv>
</div>