feat: 좋아요 하트·알림을 카드 안이 아니라 화면 위에 띄움
This commit is contained in:
1 parent
d776000028
commit
00716844c3
1 file changed
+13
-7
+13
-7
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useRef, useState, type CSSProperties, type MouseEvent, type ReactNode } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { PostType, SlotTone, type GakSlide, type HoursSlide, type PlanSlide, type PostData, type ResFeed, type RowsSlide, type SunsetSlide, type WeekSlide } from '../api/client/types.gen'
|
||||
import { cx } from '../lib/utils'
|
||||
import { cardBg, clockShort, fall } from './lib'
|
||||
@@ -392,8 +393,9 @@ function FullCard({ post }: PostProps) {
|
||||
</div>
|
||||
</div>
|
||||
{n > 1 && <Arrows api={slider} prev={canPrev} next={canNext} />}
|
||||
{pop > 0 && (
|
||||
<div key={pop} data-noshot className="pointer-events-none absolute inset-0 z-[4] grid place-items-center" aria-hidden="true">
|
||||
{/* 좋아요 효과·알림은 카드가 아니라 화면 위에 띄운다 */}
|
||||
{pop > 0 && createPortal(
|
||||
<div key={pop} className="pointer-events-none fixed inset-0 z-50 grid place-items-center" aria-hidden="true">
|
||||
{BURST.map((b, k) => (
|
||||
<svg key={k} className="b-like-bit absolute w-5" style={{ '--dx': `${b[0]}px`, '--dy': `${b[1]}px`, '--rot': `${b[2]}deg` } as CSSProperties} viewBox="0 0 24 24" fill={b[3]}>
|
||||
<path d={HEART} />
|
||||
@@ -408,12 +410,16 @@ function FullCard({ post }: PostProps) {
|
||||
</defs>
|
||||
<path d={HEART} />
|
||||
</svg>
|
||||
<span className="b-like-toast absolute top-[62%] rounded-full bg-white px-4 py-2 font-jua text-[17px] text-(--heart) opacity-0 shadow-[0_8px_18px_rgb(40_48_74/0.18)]">좋아요했어요!</span>
|
||||
</div>
|
||||
<span className="b-like-toast absolute top-[58%] rounded-full bg-white px-4 py-2 font-jua text-[17px] text-(--heart) opacity-0 shadow-[0_8px_18px_rgb(40_48_74/0.18)]">좋아요했어요!</span>
|
||||
</div>,
|
||||
document.body,
|
||||
)}
|
||||
{likeFailed > 0 && createPortal(
|
||||
<p role="alert" className="pointer-events-none fixed inset-x-0 bottom-[calc(88px+env(safe-area-inset-bottom,0px))] z-50 m-0 flex justify-center px-4">
|
||||
<span className="rounded-full bg-[rgb(30_36_56/0.82)] px-3.5 py-2 text-[13px] font-bold text-white">{liked ? '좋아요를 취소하지 못했어요' : '좋아요를 반영하지 못했어요'}. 다시 해 주세요.</span>
|
||||
</p>,
|
||||
document.body,
|
||||
)}
|
||||
<p data-noshot role="status" className="pointer-events-none absolute inset-x-0 bottom-4 z-[5] m-0 flex justify-center px-4">
|
||||
{likeFailed > 0 && <span className="rounded-full bg-[rgb(30_36_56/0.82)] px-3.5 py-2 text-[13px] font-bold text-white">{liked ? '좋아요를 취소하지 못했어요' : '좋아요를 반영하지 못했어요'}. 다시 해 주세요.</span>}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-3.5 px-3 pt-2.5 pb-1 [&_svg]:size-[26px] [&_svg]:stroke-[1.9]">
|
||||
<button type="button" onClick={() => setLike(!liked)} aria-pressed={liked} aria-label="좋아요" className="grid size-7 cursor-pointer place-items-center">
|
||||
|
||||
Reference in new issue
Block a user