mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 15:08:46 +00:00
FullscreenDiv 컴포넌트 추가 및 TopBar 컴포넌트 리팩토링
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
|
||||
import IconArrowBack from "~icons/material-symbols/arrow-back";
|
||||
|
||||
interface Props {
|
||||
children?: Snippet;
|
||||
onback?: () => void;
|
||||
title?: string;
|
||||
xPadding?: boolean;
|
||||
}
|
||||
|
||||
let { children, onback, title, xPadding = false }: Props = $props();
|
||||
|
||||
const back = $derived(() => {
|
||||
setTimeout(onback || (() => history.back()), 100);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="sticky top-0 z-10 flex flex-shrink-0 items-center justify-between bg-white py-4
|
||||
{xPadding ? 'px-4' : ''}"
|
||||
>
|
||||
<button onclick={back} class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-gray-100">
|
||||
<IconArrowBack class="text-2xl" />
|
||||
</button>
|
||||
{#if title}
|
||||
<p class="flex-grow truncate px-2 text-center text-lg font-semibold">{title}</p>
|
||||
{/if}
|
||||
<div class="w-[2.3rem] flex-shrink-0">
|
||||
{#if children}
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -10,6 +10,6 @@
|
||||
let { children, ...props }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div class={["mx-auto w-full max-w-screen-md", props.class]}>
|
||||
<div class={["mx-auto max-w-screen-md", props.class]}>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
|
||||
7
src/lib/components/atoms/divs/FullscreenDiv.svelte
Normal file
7
src/lib/components/atoms/divs/FullscreenDiv.svelte
Normal file
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
let { children } = $props();
|
||||
</script>
|
||||
|
||||
<div class="flex flex-grow flex-col justify-between px-4">
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -1,2 +1,3 @@
|
||||
export { default as AdaptiveDiv } from "./AdaptiveDiv.svelte";
|
||||
export { default as BottomDiv } from "./BottomDiv.svelte";
|
||||
export { default as FullscreenDiv } from "./FullscreenDiv.svelte";
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
export { default as BottomSheet } from "./BottomSheet.svelte";
|
||||
export { default as TopBar } from "./TopBar.svelte";
|
||||
|
||||
37
src/lib/components/molecules/TopBar.svelte
Normal file
37
src/lib/components/molecules/TopBar.svelte
Normal file
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
import type { Snippet } from "svelte";
|
||||
import type { ClassValue } from "svelte/elements";
|
||||
|
||||
import IconArrowBack from "~icons/material-symbols/arrow-back";
|
||||
|
||||
interface Props {
|
||||
children?: Snippet;
|
||||
class?: ClassValue;
|
||||
onBackClick?: () => void;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
let { children, onBackClick, title, ...props }: Props = $props();
|
||||
</script>
|
||||
|
||||
<div
|
||||
class={[
|
||||
"sticky top-0 z-10 flex items-center justify-between gap-x-2 px-2 py-3 backdrop-blur-2xl",
|
||||
props.class,
|
||||
]}
|
||||
>
|
||||
<button
|
||||
onclick={onBackClick || (() => history.back())}
|
||||
class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-black active:bg-opacity-[0.04]"
|
||||
>
|
||||
<IconArrowBack class="text-2xl" />
|
||||
</button>
|
||||
{#if title}
|
||||
<p class="flex-grow truncate text-center text-lg font-semibold">{title}</p>
|
||||
{/if}
|
||||
<div class="w-[2.3rem] flex-shrink-0">
|
||||
{#if children}
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from "./ActionModal.svelte";
|
||||
export { default as ActionModal } from "./ActionModal.svelte";
|
||||
export { default as TopBar } from "./TopBar.svelte";
|
||||
|
||||
Reference in New Issue
Block a user