flotilla/src/lib/components/Drawer.svelte

31 lines
834 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"
import {fade} from "@lib/transition"
2024-09-25 22:49:17 +00:00
2026-01-30 22:14:12 +00:00
type Props = {
onClose?: any
active?: boolean
2026-01-30 22:14:12 +00:00
children: {
component: Component
props: Record<string, any>
}
}
const {onClose, active = true, children}: Props = $props()
2024-09-25 22:49:17 +00:00
</script>
<div
inert={!active}
class="drawer fixed inset-x-0 top-0 z-modal bottom-[calc(var(--mobile-nav-height)+var(--saib))] md:bottom-0">
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="pt-sai pl-sai border-line absolute bottom-0 left-0 top-0 flex w-full overflow-hidden border-r border-solid shadow-xl md:w-80 md:pb-sai lg:w-96">
2026-01-30 22:14:12 +00:00
<children.component {...children.props} />
2024-09-25 22:49:17 +00:00
</div>
</div>