mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-22 09:46:42 +02:00
- Integrate worldream (text-first world-building platform) into games/ - Configure as @worldream/web workspace package - Remove standalone git repo, now part of monorepo 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
55 lines
1.3 KiB
Svelte
55 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { slide } from 'svelte/transition';
|
|
|
|
interface Props {
|
|
title?: string;
|
|
initiallyOpen?: boolean;
|
|
hasContent?: boolean;
|
|
children?: any;
|
|
}
|
|
|
|
let {
|
|
title = 'Weitere Optionen',
|
|
initiallyOpen = false,
|
|
hasContent = false,
|
|
children,
|
|
}: Props = $props();
|
|
|
|
// Automatically open if there's content or manually requested
|
|
let isOpen = $state(initiallyOpen || hasContent);
|
|
|
|
// Update isOpen when hasContent changes
|
|
$effect(() => {
|
|
if (hasContent && !isOpen) {
|
|
isOpen = true;
|
|
}
|
|
});
|
|
|
|
function toggle() {
|
|
isOpen = !isOpen;
|
|
}
|
|
</script>
|
|
|
|
<div class="border-t pt-6">
|
|
<button
|
|
type="button"
|
|
onclick={toggle}
|
|
class="-m-2 flex w-full items-center justify-between rounded-md p-2 text-left transition-colors hover:bg-theme-interactive-hover focus:outline-none focus:ring-2 focus:ring-theme-primary-500 focus:ring-offset-2"
|
|
>
|
|
<h2 class="text-lg font-medium text-theme-text-primary">{title}</h2>
|
|
<svg
|
|
class="h-5 w-5 text-theme-text-secondary transition-transform {isOpen ? 'rotate-180' : ''}"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width={2} d="M19 9l-7 7-7-7" />
|
|
</svg>
|
|
</button>
|
|
|
|
{#if isOpen}
|
|
<div transition:slide={{ duration: 200 }} class="mt-4 space-y-4">
|
|
{@render children?.()}
|
|
</div>
|
|
{/if}
|
|
</div>
|