mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
Modal, BeforeContinueModal 컴포넌트 추가
This commit is contained in:
32
src/lib/components/Modal.svelte
Normal file
32
src/lib/components/Modal.svelte
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from "svelte";
|
||||||
|
import { fade } from "svelte/transition";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
children: Snippet;
|
||||||
|
isOpen: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { children, isOpen = $bindable() }: Props = $props();
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
isOpen = false;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if isOpen}
|
||||||
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||||
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||||
|
<div
|
||||||
|
onclick={closeModal}
|
||||||
|
class="fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 px-2"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
onclick={(e) => e.stopPropagation()}
|
||||||
|
class="max-w-full rounded-2xl bg-white p-4"
|
||||||
|
transition:fade={{ duration: 100 }}
|
||||||
|
>
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
@@ -23,7 +23,14 @@
|
|||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button {onclick} class="{bgColorStyle} {fontColorStyle} h-12 h-full w-full rounded-xl font-medium">
|
<button
|
||||||
|
onclick={() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
onclick?.();
|
||||||
|
}, 100);
|
||||||
|
}}
|
||||||
|
class="{bgColorStyle} {fontColorStyle} h-12 w-full rounded-xl font-medium"
|
||||||
|
>
|
||||||
<div class="h-full w-full p-3 transition active:scale-95">
|
<div class="h-full w-full p-3 transition active:scale-95">
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
{onclick}
|
onclick={() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
onclick?.();
|
||||||
|
}, 100);
|
||||||
|
}}
|
||||||
class="text-sm font-medium text-gray-800 underline underline-offset-2 active:rounded-xl active:bg-gray-100"
|
class="text-sm font-medium text-gray-800 underline underline-offset-2 active:rounded-xl active:bg-gray-100"
|
||||||
>
|
>
|
||||||
<div class="h-full w-full p-1 transition active:scale-95">
|
<div class="h-full w-full p-1 transition active:scale-95">
|
||||||
|
|||||||
1
src/lib/components/index.ts
Normal file
1
src/lib/components/index.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { default as Modal } from "./Modal.svelte";
|
||||||
@@ -1,10 +1,25 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, TextButton } from "$lib/components/buttons";
|
import { Button, TextButton } from "$lib/components/buttons";
|
||||||
import { BottomDiv } from "$lib/components/divs";
|
import { BottomDiv } from "$lib/components/divs";
|
||||||
|
import BeforeContinueModal from "./BeforeContinueModal.svelte";
|
||||||
|
|
||||||
import IconKey from "~icons/material-symbols/key";
|
import IconKey from "~icons/material-symbols/key";
|
||||||
|
|
||||||
let { data } = $props();
|
let { data } = $props();
|
||||||
|
|
||||||
|
let isBeforeContinueModalOpen = $state(false);
|
||||||
|
|
||||||
|
const exportKeyPair = () => {
|
||||||
|
// TODO
|
||||||
|
console.log(data.pubKeyBase64);
|
||||||
|
console.log(data.privKeyBase64);
|
||||||
|
};
|
||||||
|
|
||||||
|
const continueWithoutExport = () => {
|
||||||
|
isBeforeContinueModalOpen = false;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svetle:head>
|
<svetle:head>
|
||||||
@@ -27,17 +42,22 @@
|
|||||||
</div>
|
</div>
|
||||||
<BottomDiv>
|
<BottomDiv>
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<Button
|
<Button onclick={exportKeyPair}>암호 키 내보내기</Button>
|
||||||
onclick={() => {
|
|
||||||
// TODO
|
|
||||||
console.log(data.privKeyBase64);
|
|
||||||
console.log(data.pubKeyBase64);
|
|
||||||
}}>암호 키 내보내기</Button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="w-fit">
|
<div class="w-fit">
|
||||||
<TextButton>내보내지 않을래요</TextButton>
|
<TextButton
|
||||||
|
onclick={() => {
|
||||||
|
isBeforeContinueModalOpen = true;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
내보내지 않을래요
|
||||||
|
</TextButton>
|
||||||
</div>
|
</div>
|
||||||
</BottomDiv>
|
</BottomDiv>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<BeforeContinueModal
|
||||||
|
bind:isOpen={isBeforeContinueModalOpen}
|
||||||
|
onContinueClick={continueWithoutExport}
|
||||||
|
/>
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Modal } from "$lib/components";
|
||||||
|
import { Button } from "$lib/components/buttons";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
onContinueClick: () => void;
|
||||||
|
isOpen: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { onContinueClick, isOpen = $bindable() }: Props = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal bind:isOpen>
|
||||||
|
<div class="space-y-4 px-1">
|
||||||
|
<div class="space-y-2">
|
||||||
|
<p class="break-keep text-xl font-bold">내보내지 않고 계속할까요?</p>
|
||||||
|
<p class="break-keep">
|
||||||
|
보안상의 이유로 지금 시점 이후로는 암호 키를 파일로 내보낼 수 없어요.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<Button
|
||||||
|
color="gray"
|
||||||
|
onclick={() => {
|
||||||
|
isOpen = false;
|
||||||
|
}}>아니요</Button
|
||||||
|
>
|
||||||
|
<Button onclick={onContinueClick}>계속합니다</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
Reference in New Issue
Block a user