모바일 환경에서 SearchBar의 레이아웃이 깨지는 문제 수정

This commit is contained in:
static
2026-01-18 14:16:40 +09:00
parent 72babc532f
commit 2f6d35c335
6 changed files with 64 additions and 58 deletions

View File

@@ -46,7 +46,7 @@
{#if isOpen && (directoryId || downloadUrl || fileBlob)} {#if isOpen && (directoryId || downloadUrl || fileBlob)}
<div <div
class="absolute right-2 top-full z-20 min-w-40 space-y-1 rounded-lg bg-white px-1 py-2 shadow-2xl" class="absolute right-2 top-full z-20 min-w-44 space-y-1 rounded-lg bg-white px-1 py-2 shadow-2xl"
transition:fly={{ y: -8, duration: 200 }} transition:fly={{ y: -8, duration: 200 }}
> >
<p class="px-3 pt-2 text-sm font-semibold text-gray-600">더보기</p> <p class="px-3 pt-2 text-sm font-semibold text-gray-600">더보기</p>
@@ -57,7 +57,9 @@
onclick: () => void, onclick: () => void,
)} )}
<button {onclick} class="rounded-xl active:bg-gray-100"> <button {onclick} class="rounded-xl active:bg-gray-100">
<div class="flex items-center gap-x-3 px-3 py-2 text-gray-700 transition active:scale-95"> <div
class="flex items-center gap-x-3 px-3 py-2 text-lg text-gray-700 transition active:scale-95"
>
<Icon /> <Icon />
<p class="font-medium">{text}</p> <p class="font-medium">{text}</p>
</div> </div>

View File

@@ -1,17 +1,14 @@
<script lang="ts"> <script lang="ts">
import type { ClassValue } from "svelte/elements";
import IconArrowBack from "~icons/material-symbols/arrow-back"; import IconArrowBack from "~icons/material-symbols/arrow-back";
interface Props { interface Props {
class?: ClassValue;
value: string; value: string;
} }
let { class: className, value = $bindable() }: Props = $props(); let { value = $bindable() }: Props = $props();
</script> </script>
<div class={["sticky top-0 z-10 flex items-center gap-x-2 px-2 py-3 backdrop-blur-2xl", className]}> <div class={"sticky top-0 z-10 flex items-center gap-x-2 px-2 py-3 backdrop-blur-2xl"}>
<button <button
onclick={() => history.back()} onclick={() => history.back()}
class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-black active:bg-opacity-[0.04]" class="w-[2.3rem] flex-shrink-0 rounded-full p-1 active:bg-black active:bg-opacity-[0.04]"
@@ -22,6 +19,6 @@
bind:value bind:value
type="text" type="text"
placeholder="검색" placeholder="검색"
class="mr-1 h-[2.3rem] flex-grow rounded-lg bg-gray-100 px-3 py-1.5 placeholder-gray-600 focus:outline-none" class="mr-1 h-[2.3rem] min-w-0 flex-grow rounded-lg bg-gray-100 px-3 py-1.5 placeholder-gray-600 focus:outline-none"
/> />
</div> </div>

View File

@@ -3,6 +3,7 @@
import { DirectoryEntryLabel } from "$lib/components/molecules"; import { DirectoryEntryLabel } from "$lib/components/molecules";
import { getFileThumbnail } from "$lib/modules/file"; import { getFileThumbnail } from "$lib/modules/file";
import type { CategoryFileInfo } from "$lib/modules/filesystem"; import type { CategoryFileInfo } from "$lib/modules/filesystem";
import { formatDateTime } from "$lib/utils";
import type { SelectedFile } from "./service.svelte"; import type { SelectedFile } from "./service.svelte";
import IconClose from "~icons/material-symbols/close"; import IconClose from "~icons/material-symbols/close";
@@ -19,7 +20,7 @@
</script> </script>
<ActionEntryButton <ActionEntryButton
class="h-12" class="h-14"
onclick={() => onclick(info)} onclick={() => onclick(info)}
actionButtonIcon={onRemoveClick && IconClose} actionButtonIcon={onRemoveClick && IconClose}
onActionButtonClick={() => onRemoveClick?.(info)} onActionButtonClick={() => onRemoveClick?.(info)}
@@ -28,6 +29,7 @@
type="file" type="file"
thumbnail={$thumbnail} thumbnail={$thumbnail}
name={info.name} name={info.name}
subtext={formatDateTime(info.createdAt ?? info.lastModifiedAt)}
isFavorite={info.isFavorite} isFavorite={info.isFavorite}
/> />
</ActionEntryButton> </ActionEntryButton>

View File

@@ -103,7 +103,7 @@
</script> </script>
<svelte:head> <svelte:head>
<title>파일</title> <title>파일</title>
</svelte:head> </svelte:head>
<input bind:this={fileInput} onchange={uploadFile} type="file" multiple class="hidden" /> <input bind:this={fileInput} onchange={uploadFile} type="file" multiple class="hidden" />

View File

@@ -44,52 +44,50 @@
<title>즐겨찾기</title> <title>즐겨찾기</title>
</svelte:head> </svelte:head>
<TopBar title="즐겨찾기" showBackButton={false}> <div class="flex h-full flex-col">
<button <TopBar title="즐겨찾기" showBackButton={false}>
onclick={() => goto("/search?from=favorites")} <button
class="w-full rounded-full p-1 text-2xl active:bg-black active:bg-opacity-[0.04]" onclick={() => goto("/search?from=favorites")}
> class="w-full rounded-full p-1 text-2xl active:bg-black active:bg-opacity-[0.04]"
<IconSearch />
</button>
</TopBar>
<div class="flex h-full flex-col p-4 !pt-0">
{#if isLoading}
<div class="flex flex-grow items-center justify-center">
<p class="text-gray-500">
{#if data.favorites.files.length === 0 && data.favorites.directories.length === 0}
즐겨찾기한 항목이 없어요.
{:else}
즐겨찾기 목록을 불러오고 있어요.
{/if}
</p>
</div>
{:else if entries.length === 0}
<div class="flex flex-grow items-center justify-center">
<p class="text-gray-500">즐겨찾기한 항목이 없어요.</p>
</div>
{:else}
<RowVirtualizer
count={entries.length}
getItemKey={(index) => `${entries[index]!.type}-${entries[index]!.details.id}`}
estimateItemHeight={() => 56}
itemGap={4}
> >
{#snippet item(index)} <IconSearch />
{@const entry = entries[index]!} </button>
{#if entry.type === "directory"} </TopBar>
<Directory <div class="flex flex-grow flex-col px-4 pb-4">
info={entry.details} {#if entries.length > 0}
onclick={() => handleClick(entry)} <RowVirtualizer
onRemoveClick={() => handleRemove(entry)} count={entries.length}
/> getItemKey={(index) => `${entries[index]!.type}-${entries[index]!.details.id}`}
{:else} estimateItemHeight={() => 56}
<File itemGap={4}
info={entry.details} >
onclick={() => handleClick(entry)} {#snippet item(index)}
onRemoveClick={() => handleRemove(entry)} {@const entry = entries[index]!}
/> {#if entry.type === "directory"}
{/if} <Directory
{/snippet} info={entry.details}
</RowVirtualizer> onclick={() => handleClick(entry)}
{/if} onRemoveClick={() => handleRemove(entry)}
/>
{:else}
<File
info={entry.details}
onclick={() => handleClick(entry)}
onRemoveClick={() => handleRemove(entry)}
/>
{/if}
{/snippet}
</RowVirtualizer>
{:else}
<div class="flex flex-grow items-center justify-center">
<p class="text-gray-500">
{#if isLoading}
즐겨찾기 목록을 불러오고 있어요.
{:else}
즐겨찾기한 항목이 없어요.
{/if}
</p>
</div>
{/if}
</div>
</div> </div>

View File

@@ -3,6 +3,7 @@
import { DirectoryEntryLabel } from "$lib/components/molecules"; import { DirectoryEntryLabel } from "$lib/components/molecules";
import { getFileThumbnail } from "$lib/modules/file"; import { getFileThumbnail } from "$lib/modules/file";
import type { SummarizedFileInfo } from "$lib/modules/filesystem"; import type { SummarizedFileInfo } from "$lib/modules/filesystem";
import { formatDateTime } from "$lib/utils";
import IconClose from "~icons/material-symbols/close"; import IconClose from "~icons/material-symbols/close";
@@ -23,5 +24,11 @@
actionButtonIcon={IconClose} actionButtonIcon={IconClose}
onActionButtonClick={onRemoveClick} onActionButtonClick={onRemoveClick}
> >
<DirectoryEntryLabel type="file" thumbnail={$thumbnail} name={info.name} isFavorite /> <DirectoryEntryLabel
type="file"
thumbnail={$thumbnail}
name={info.name}
subtext={formatDateTime(info.createdAt ?? info.lastModifiedAt)}
isFavorite
/>
</ActionEntryButton> </ActionEntryButton>