From 117de90c3efe7af56c7a087a3637ac4f794485f8 Mon Sep 17 00:00:00 2001 From: Mina Choi Date: Tue, 27 Oct 2026 15:08:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=95=84=EB=9E=98=20=EC=B0=BD(=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EB=93=B1)=EC=9D=B4=20=EC=97=B4=EB=A6=AC?= =?UTF-8?q?=EA=B3=A0=20=EB=8B=AB=ED=9E=90=20=EB=95=8C=20=EB=B2=84=EB=B2=85?= =?UTF-8?q?=EC=97=AC=20=EB=B3=B4=EC=9D=B4=EB=8D=98=20=EA=B2=83=20=E2=80=94?= =?UTF-8?q?=20=EB=B0=98=ED=88=AC=EB=AA=85=EC=9C=BC=EB=A1=9C=2040px?= =?UTF-8?q?=EB=A7=8C=20=EC=98=AC=EB=9D=BC=EC=99=80=20=EB=92=A4=20=ED=83=AD?= =?UTF-8?q?=20=EB=B0=94=EA=B0=80=20=EB=B9=84=EC=B3=A4=EA=B3=A0=20=EB=8B=AB?= =?UTF-8?q?=ED=9E=90=20=EB=95=90=20=ED=88=AD=20=EC=82=AC=EB=9D=BC=EC=A7=80?= =?UTF-8?q?=EB=A9=B0=20=EC=93=B0=EA=B8=B0=20=EC=B9=B8=20=ED=85=8C=EB=91=90?= =?UTF-8?q?=EB=A6=AC=EA=B0=80=20=EB=B2=88=EC=A9=8D=EC=98=80=EC=9D=8C,=20?= =?UTF-8?q?=EB=B6=88=ED=88=AC=EB=AA=85=ED=95=98=EA=B2=8C=20=EC=95=84?= =?UTF-8?q?=EB=9E=98=EC=97=90=EC=84=9C=20=EB=81=9D=EA=B9=8C=EC=A7=80=20?= =?UTF-8?q?=EC=98=AC=EB=9D=BC=EC=98=A4=EA=B3=A0=20=EB=82=B4=EB=A0=A4?= =?UTF-8?q?=EA=B0=80=EB=A9=B0=20=EB=8B=AB=ED=9E=88=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/b/Sheets.tsx | 59 ++++++++++++++++++++++++++------------- frontend/src/b/b.css | 36 ++++++++++++++++++++---- frontend/src/b/lib.ts | 2 ++ frontend/src/b/talk.tsx | 7 ++++- 4 files changed, 78 insertions(+), 26 deletions(-) diff --git a/frontend/src/b/Sheets.tsx b/frontend/src/b/Sheets.tsx index 6fa9131..44a568b 100644 --- a/frontend/src/b/Sheets.tsx +++ b/frontend/src/b/Sheets.tsx @@ -34,7 +34,7 @@ import { ago, articleMeta, AVATAR_COLORS, cardBg, CHARACTERS, dateRange, loadOf, import { GoogleButton } from './googleLogin' import { useInstall, useInstallable } from './install' import { InstallSheet } from './installBanner' -import { ARTICLE_CAT, SHEET_OPEN_MS } from './lib' +import { ARTICLE_CAT, SHEET_CLOSE_MS, SHEET_OPEN_MS } from './lib' import { MixSheet } from './myGak' import { ownPage, useRegion } from './regionContext' import { WeatherWhySheet } from './weatherWhy' @@ -95,11 +95,25 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void const [gakTitle, setGakTitle] = useState('') const [articleTitle, setArticleTitle] = useState('') + // 닫히는 동안에도 내려가는 창에 내용이 남아 있게, 마지막으로 연 창을 들고 있는다 + const [shown, setShown] = useState(state) + if (state && state !== shown) setShown(state) + const closing = !state && shown != null + useEffect(() => { const el = ref.current if (!el) return - if (state && !el.open) el.showModal() - if (!state && el.open) el.close() + if (state) { + if (!el.open) el.showModal() + return + } + if (!el.open) return + // 내려가는 애니메이션이 끝난 뒤에 실제로 닫는다 + const t = setTimeout(() => { + el.close() + setShown(null) + }, SHEET_CLOSE_MS) + return () => clearTimeout(t) }, [state]) // 창이 열려 있는 동안 뒤 페이지는 스크롤되지 않게 잠근다 @@ -118,8 +132,8 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void } }, [isOpen]) - const then = state?.type === 'login' ? state.then : undefined - const title = !state ? '' : state.type === 'gak' ? gakTitle : state.type === 'article' ? articleTitle || TITLES.article : state.type === 'mix' ? (state.shared ? '받은 각' : '내 각 만들기') : TITLES[state.type] + const then = shown?.type === 'login' ? shown.then : undefined + const title = !shown ? '' : shown.type === 'gak' ? gakTitle : shown.type === 'article' ? articleTitle || TITLES.article : shown.type === 'mix' ? (shown.shared ? '받은 각' : '내 각 만들기') : TITLES[shown.type] return ( void aria-label={title} data-t={kind} onClose={onClose} + // ESC 도 바로 닫지 않고 내려가며 닫히게 + onCancel={(e) => { + e.preventDefault() + onClose() + }} onClick={(e) => { if (e.target === e.currentTarget) onClose() }} - className="b-sheet-dialog b-app fixed inset-x-0 top-auto bottom-0 m-0 mx-auto max-h-[86dvh] w-full max-w-[440px] overflow-visible bg-transparent p-0 text-(--ink)" + className={cx('b-sheet-dialog b-app fixed inset-x-0 top-auto bottom-0 m-0 mx-auto max-h-[86dvh] w-full max-w-[440px] overflow-visible bg-transparent p-0 text-(--ink)', closing && 'b-sheet-closing')} > - {state && ( + {shown && (
- {state.type === 'gak' && } - {state.type === 'article' && } - {state.type === 'seasonWeek' && } - {state.type === 'share' && } - {state.type === 'comments' && } - {state.type === 'login' && open(then) : onClose} />} - {state.type === 'me' && } - {state.type === 'region' && } - {state.type === 'mix' && } - {state.type === 'install' && } - {state.type === 'weatherWhy' && } - {state.type === 'talk' && } + {shown.type === 'gak' && } + {shown.type === 'article' && } + {shown.type === 'seasonWeek' && } + {shown.type === 'share' && } + {shown.type === 'comments' && } + {shown.type === 'login' && open(then) : onClose} />} + {shown.type === 'me' && } + {shown.type === 'region' && } + {shown.type === 'mix' && } + {shown.type === 'install' && } + {shown.type === 'weatherWhy' && } + {shown.type === 'talk' && }
)} - {!state && } + {!shown && }
) } diff --git a/frontend/src/b/b.css b/frontend/src/b/b.css index b60daa6..d2c2427 100644 --- a/frontend/src/b/b.css +++ b/frontend/src/b/b.css @@ -120,13 +120,37 @@ } } +/* 아래 창은 불투명한 채로 화면 아래에서 끝까지 올라오고, 닫힐 땐 다시 내려간다 (반투명으로 올라오면 뒤 탭 바가 비쳐 깜빡여 보였다) */ .b-sheet { - animation: b-up 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); + animation: b-up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); +} +.b-sheet-dialog[open]::backdrop { + animation: b-fade-in 0.2s ease-out; +} +.b-sheet-closing .b-sheet { + animation: b-down 0.2s ease-in forwards; +} +.b-sheet-closing::backdrop { + animation: b-fade-out 0.2s ease-in forwards; } @keyframes b-up { from { - transform: translateY(40px); - opacity: 0.4; + transform: translateY(100%); + } +} +@keyframes b-down { + to { + transform: translateY(100%); + } +} +@keyframes b-fade-in { + from { + opacity: 0; + } +} +@keyframes b-fade-out { + to { + opacity: 0; } } @@ -150,11 +174,13 @@ .b-fall, .b-heart-pop, .b-like-bit, - .b-sheet { + .b-sheet, + .b-sheet-dialog[open]::backdrop { animation: none !important; } .b-heart-pop, - .b-like-bit { + .b-like-bit, + .b-sheet-closing .b-sheet { opacity: 0; } } diff --git a/frontend/src/b/lib.ts b/frontend/src/b/lib.ts index 628574e..507500c 100644 --- a/frontend/src/b/lib.ts +++ b/frontend/src/b/lib.ts @@ -17,3 +17,5 @@ export const ARTICLE_CAT: Record = { 1: [ARTICLE_LABEL /** 아래 창이 다 올라오는 시간(.b-sheet 0.26s). 무거운 일은 이 뒤로 미뤄 올라오는 동안 버벅이지 않게 */ export const SHEET_OPEN_MS = 280 +/** 아래 창이 내려가며 닫히는 시간(.b-sheet-closing 0.2s). 이 뒤에 실제로 닫는다 */ +export const SHEET_CLOSE_MS = 200 diff --git a/frontend/src/b/talk.tsx b/frontend/src/b/talk.tsx index 22f562f..2a474de 100644 --- a/frontend/src/b/talk.tsx +++ b/frontend/src/b/talk.tsx @@ -131,7 +131,12 @@ function Composer({ onDone }: { onDone?: (t: TalkData) => void }) { value={text} onChange={(e) => setText(e.target.value)} // 로그인 전엔 읽기 전용이라 눌러도 키보드가 안 올라온다 (키보드가 떴다 내려가며 로그인 창이 버벅이던 것). 누르거나 Enter 면 로그인 창 - onClick={() => !loggedIn && open({ type: 'login' })} + onClick={(e) => { + if (loggedIn) return + // 창이 닫힐 때 포커스가 이 칸으로 돌아와 테두리가 번쩍이지 않게 + e.currentTarget.blur() + open({ type: 'login' }) + }} onKeyDown={(e) => { if (loggedIn || (e.key !== 'Enter' && e.key !== ' ')) return e.preventDefault()