flotilla/src/lib/components/Drawer.svelte

29 lines
730 B
Svelte
Raw Normal View History

2024-09-25 22:49:17 +00:00
<script lang="ts">
2026-01-30 22:14:12 +00:00
import type {Component} from "svelte"
2024-10-17 21:26:53 +00:00
import {fade, translate} from "@lib/transition"
2024-09-25 22:49:17 +00:00
2026-01-30 22:14:12 +00:00
type Props = {
onClose?: any
children: {
component: Component
props: Record<string, any>
}
}
const {onClose, children}: Props = $props()
2024-09-25 22:49:17 +00:00
</script>
2024-10-24 22:48:45 +00:00
<div class="drawer fixed inset-0 z-modal">
2024-10-15 22:52:30 +00:00
<button
2025-02-03 23:01:42 +00:00
aria-label="Close drawer"
2024-10-15 22:52:30 +00:00
class="absolute inset-0 cursor-pointer bg-black opacity-50"
transition:fade
2025-02-04 00:37:14 +00:00
onclick={onClose}>
2025-02-03 23:01:42 +00:00
</button>
2024-10-15 22:52:30 +00:00
<div
class="bg-surface scroll-container py-sai pr-sair absolute bottom-0 right-0 top-0 w-72 overflow-auto lg:w-96"
2024-10-17 21:26:53 +00:00
transition:translate={{axis: "x", duration: 300}}>
2026-01-30 22:14:12 +00:00
<children.component {...children.props} />
2024-09-25 22:49:17 +00:00
</div>
</div>