Modal, AdaptiveDiv, BottomDiv 컴포넌트를 molecules 디렉터리로 이동 및 리팩토링

This commit is contained in:
static
2025-01-24 21:24:59 +09:00
parent 1c09d93b41
commit fea9cd729c
40 changed files with 279 additions and 246 deletions

View File

@@ -0,0 +1,42 @@
<script lang="ts">
import { TextInput } from "$lib/components/atoms";
import { ActionModal, type ConfirmHandler } from "$lib/components/molecules";
interface Props {
defaultValue?: string;
isOpen: boolean;
onbeforeclose?: () => void;
onsubmit: (value: string) => ReturnType<ConfirmHandler>;
placeholder: string;
submitText: string;
title: string;
}
let {
defaultValue = "",
isOpen = $bindable(),
onbeforeclose,
onsubmit,
placeholder,
submitText,
title,
}: Props = $props();
let value = $state(defaultValue);
$effect.pre(() => {
if (isOpen) {
value = defaultValue;
}
});
</script>
<ActionModal
bind:isOpen
{onbeforeclose}
{title}
confirmText={submitText}
onconfirm={() => onsubmit(value)}
>
<TextInput bind:value {placeholder} class="mb-5" />
</ActionModal>