chore: main 병합 — 이야기 상세 창·카드 정렬·히어로 아이콘

This commit is contained in:
minaChoi committed 2026-10-23 15:41:20 +09:00
commit 2ebd13c100
4 files changed
+39 -15

No files matched your search

+3 -2
View File
@@ -33,7 +33,7 @@ import { useSky } from './skyContext'
import { SHARE_SIZES, shareImage, type ShareSize } from './storyImage'
import { SheetContext, useSheet, type SharePayload, type SheetState } from './sheetContext'
import { HeartIcon } from './svg'
import { MyTalks } from './talk'
import { MyTalks, TalkSheet } from './talk'
import { Avatar, Ic, Skel, StateBox, TAP44, Thumb } from './ui'
export function SheetProvider({ children }: { children: ReactNode }) {
@@ -76,7 +76,7 @@ export function SheetProvider({ children }: { children: ReactNode }) {
)
}
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요' } as const
const TITLES = { article: '읽을거리', seasonWeek: '이번 주 특집', share: '보내기', comments: '댓글', login: '로그인', me: '내 정보', region: '지역 바꾸기', install: '홈 화면에 추가', weatherWhy: '날씨 점수는 이렇게 나와요', talk: '이야기' } as const
/** 아래에서 올라오는 창: 네이티브 <dialog>라 ESC·포커스 가두기·포커스 되돌리기가 기본으로 된다 */
function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void }) {
@@ -141,6 +141,7 @@ function SheetHost({ state, onClose }: { state: SheetState; onClose: () => void
{state.type === 'mix' && <MixSheet shared={state.shared} onDone={onClose} />}
{state.type === 'install' && <InstallSheet />}
{state.type === 'weatherWhy' && <WeatherWhySheet d={state.why} />}
{state.type === 'talk' && <TalkSheet talk={state.talk} />}
</div>
)}
{!state && <RegionLinks />}
+6 -4
View File
@@ -156,6 +156,8 @@ const WEATHER_ICON: Record<Weather, string> = {
sleet: 'snow',
}
// 구름 수: 구름 많음 둘, 흐림·비·눈 셋
// 히어로 오른쪽 위 좋아요·댓글·보내기: 셋 다 같은 32px 칸에 아이콘 가운데, 수는 아이콘 옆
const HERO_ACT = 'relative flex h-8 min-w-8 cursor-pointer items-center justify-center gap-1 text-[13px] font-extrabold'
const CLOUDS = [
{ cls: 'top-9 left-[5%] h-8 w-[84px]', d: '.1s', f: '6s' },
{ cls: 'top-[96px] left-[63%] h-9 w-[96px]', d: '.25s', f: '6.4s' },
@@ -332,7 +334,7 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
{t.mo}월 {t.d}일 {WEEKDAYS[t.wd]}요일
</span>
</span>
<span className="flex items-center gap-3 [&_svg]:size-[22px] [&_svg]:stroke-[2]">
<span className="flex items-center gap-1 [&_svg]:size-[22px] [&_svg]:stroke-[2]">
{post && (
<>
<button
@@ -340,7 +342,7 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
onClick={like.toggle}
aria-pressed={like.liked}
aria-label={like.failed ? '좋아요를 반영하지 못했어요. 다시 눌러 주세요' : '오늘 날씨 좋아요'}
className={cx('relative flex cursor-pointer items-center gap-1 text-[13px] font-extrabold', TAP44, !like.liked && 'opacity-80')}
className={cx(HERO_ACT, TAP44, !like.liked && 'opacity-80')}
>
<HeartIcon className={like.liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-current'} />
{like.count > 0 && like.count.toLocaleString()}
@@ -349,14 +351,14 @@ function Hero({ hero, post, today, ranked, all, feedLoad, todayLoad }: HeroProps
type="button"
onClick={() => open({ type: 'comments', postId: post.post_id })}
aria-label="오늘 날씨 댓글"
className={cx('relative flex cursor-pointer items-center gap-1 text-[13px] font-extrabold opacity-80', TAP44)}
className={cx(HERO_ACT, 'opacity-80', TAP44)}
>
<CommentIcon className="fill-none stroke-current [stroke-linejoin:round]" />
{post.comment_count > 0 && post.comment_count.toLocaleString()}
</button>
</>
)}
<button type="button" onClick={share} aria-label="오늘 날씨 보내기" className={cx('relative grid size-7 cursor-pointer place-items-center opacity-80', TAP44)}>
<button type="button" onClick={share} aria-label="오늘 날씨 보내기" className={cx(HERO_ACT, 'opacity-80', TAP44)}>
<SendIcon className="fill-none stroke-current [stroke-linecap:round] [stroke-linejoin:round]" />
</button>
</span>
+2
View File
@@ -1,4 +1,5 @@
import type { MyGak } from './myGakState'
import type { TalkData } from '../api/client/types.gen'
import type { WeatherWhyPayload } from './weatherWhy'
import { createContext, use } from 'react'
/** square: 1:1 비율일 때 slides 대신 찍을 틀 (없으면 slides) */
@@ -18,6 +19,7 @@ export type SheetState =
| { type: 'mix'; shared?: MyGak }
| { type: 'install' }
| { type: 'weatherWhy'; why: WeatherWhyPayload }
| { type: 'talk'; talk: TalkData }
| null
export type SheetApi = { open: (s: Exclude<SheetState, null>) => void; close: () => void }
+28 -9
View File
@@ -230,17 +230,27 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
const src = t.image?.startsWith('/v1/') ? API_BASE_URL + t.image : (t.image ?? undefined)
return (
<div className="grid grid-cols-[34px_1fr_24px] items-start gap-2.5 border-b border-(--line) py-2.5 last:border-b-0">
<Avatar character={t.character} color={t.color} mood={t.mood} />
<div className="min-w-0">
<small className="block text-xs font-bold text-(--ink3)">
<div className={cx('grid grid-cols-[34px_1fr_24px] gap-2.5 border-b border-(--line) py-2.5 last:border-b-0', compact ? 'h-full w-full items-stretch' : 'items-start')}>
<span className="self-start">
<Avatar character={t.character} color={t.color} mood={t.mood} />
</span>
{/* 묶음 카드는 옆 카드 높이에 맞춰 늘어나니, 시간·좋아요 줄을 맨 아래에 붙여 빈 곳이 아래에 몰리지 않게 */}
<div className={cx('min-w-0', compact && 'flex flex-col')}>
<small className={cx('block text-xs font-bold text-(--ink3)', compact && 'truncate')}>
<b className="mr-1 font-extrabold text-(--ink)">{t.nickname}</b>
{[t.region_name, slotWord(t.created_at), t.weather, t.topic && t.topic !== TalkTopic.LOCAL ? topicName(t.topic) : null].filter(Boolean).join(' · ')}
</small>
{t.image && compact && <img src={src} alt="" loading="lazy" className="float-right mt-1 ml-2 size-12 rounded-xl bg-[#eef4fc] object-cover" />}
<p className={cx('m-0 mt-0.5 text-[14.5px] break-words whitespace-pre-wrap', compact && 'line-clamp-2')}>{t.body}</p>
{/* 묶음 안 작은 카드는 글이 잘리니, 누르면 창에서 글 전체·큰 사진을 본다 */}
{compact ? (
<button type="button" onClick={() => open({ type: 'talk', talk: { ...t, liked, like_count: count } })} aria-label={`${t.nickname}의 글 전체 보기`} className="block w-full cursor-pointer text-left">
{t.image && <img src={src} alt="" loading="lazy" className="float-right mt-1 ml-2 size-12 rounded-xl bg-[#eef4fc] object-cover" />}
<p className="m-0 mt-0.5 line-clamp-2 min-h-[2lh] text-[14.5px] break-words whitespace-pre-wrap">{t.body}</p>
</button>
) : (
<p className="m-0 mt-0.5 text-[14.5px] break-words whitespace-pre-wrap">{t.body}</p>
)}
{t.image && !compact && <img src={src} alt="" loading="lazy" className="mt-2 aspect-[4/5] w-full rounded-2xl bg-[#eef4fc] object-cover" />}
<small className="mt-0.5 block text-xs font-bold text-(--ink3)">
<small className={cx('block text-xs font-bold text-(--ink3)', compact ? 'mt-auto pt-1.5' : 'mt-0.5')}>
{ago(t.created_at)} · 좋아요 {count}개 ·{' '}
<button type="button" onClick={() => setMenu(menu === 'closed' ? 'open' : 'closed')} aria-expanded={menu !== 'closed'} className="cursor-pointer font-bold text-(--ink3)">
{t.mine ? '내 글' : '더보기'}
@@ -278,7 +288,7 @@ function TalkRow({ t, onGone, compact }: { t: TalkData; onGone?: () => void; com
</div>
)}
</div>
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative cursor-pointer pt-1', TAP44)}>
<button type="button" onClick={toggle} aria-pressed={liked} aria-label="좋아요" className={cx('relative cursor-pointer self-start pt-1', TAP44)}>
<HeartIcon className={cx('size-4 stroke-2', liked ? 'fill-(--heart) stroke-(--heart)' : 'fill-none stroke-(--ink3)')} />
</button>
</div>
@@ -295,6 +305,15 @@ export function FeedComposer({ onPosted }: { onPosted: (t: TalkData) => void })
)
}
/** 묶음에서 누른 글 하나를 창으로: 글 전체·큰 사진·좋아요·더보기 */
export function TalkSheet({ talk }: { talk: TalkData }) {
return (
<div className="flex-1 overflow-auto overscroll-contain px-4 pb-[18px]">
<TalkRow t={talk} />
</div>
)
}
/** 피드에 끼우는 글 한 장 */
export function TalkCard({ t, onGone }: { t: TalkData; onGone?: () => void }) {
return (
@@ -316,7 +335,7 @@ export function TalkGroup({ title, topic, talks }: { title: string; topic?: numb
</div>
<Rail label={title}>
{talks.map((t) => (
<article key={`${t.talk_id}:${t.liked}:${t.like_count}`} className="w-[78%] max-w-[320px] rounded-[20px] bg-white px-3 shadow-[inset_0_-4px_0_var(--shade)]" aria-label={`${t.nickname}의 글`}>
<article key={`${t.talk_id}:${t.liked}:${t.like_count}`} className="flex w-[78%] max-w-[320px] rounded-[20px] bg-white px-3 shadow-[inset_0_-4px_0_var(--shade)]" aria-label={`${t.nickname}의 글`}>
<TalkRow t={t} compact />
</article>
))}