feat: 계절 이야기에 사진 연결 (띠·목록·상세·피드, CC BY 계열 출처 표기)

This commit is contained in:
minaChoi committed 2026-10-08 09:10:10 +09:00
1 parent e8382f450b
commit ba62e82f1b
15 files changed
+77 -21

No files matched your search

+2 -4
View File
@@ -5,7 +5,7 @@ import { ArticleCategory } from '../api/client/types.gen'
import { cx } from '../lib/utils'
import { ARTICLE_CAT, cardBg, dateRange, fall, loadOf, shortDay } from './lib'
import { useSheet } from './sheetContext'
import { Chips, Ic, Skel, StateBox } from './ui'
import { Chips, Ic, Skel, StateBox, Thumb } from './ui'
const CATS = [
['all', '전체'],
@@ -126,9 +126,7 @@ export function SeasonPage() {
<b className="mt-0.5 block font-jua text-[17.5px] leading-snug font-normal">{a.title}</b>
<small className="mt-1 block text-xs font-semibold text-(--ink3)">{a.read_minutes}분 읽기</small>
</span>
<span className={cx('grid h-[84px] place-items-center rounded-[18px]', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-[54px]" />
</span>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('h-[84px] rounded-[18px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-[54px]" creditClassName="right-1 bottom-1 max-w-[calc(100%-8px)] whitespace-normal!" />
</button>
))}
</div>
+2 -4
View File
@@ -28,7 +28,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 { Avatar, Ic, Skel, StateBox } from './ui'
import { Avatar, Ic, Skel, StateBox, Thumb } from './ui'
export function SheetProvider({ children }: { children: ReactNode }) {
const [state, setState] = useState<SheetState>(null)
@@ -397,9 +397,7 @@ function ArticleSheet({ articleId, onTitle }: { articleId: number; onTitle: (t:
if (!a) return <Body>{load === 'loading' ? <ArticleSkel /> : <StateBox load={load} onRetry={() => q.refetch()} empty="글을 찾지 못했어요." hold={<ArticleSkel />} className="inset-0" />}</Body>
return (
<Body>
<div className={cx('mb-3.5 grid h-[150px] place-items-center rounded-[20px]', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-24" />
</div>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('mb-3.5 h-[150px] rounded-[20px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-24" />
<p className="text-[13px] font-extrabold text-(--ink2)">{articleMeta(a)}</p>
<h4 className="mt-1.5 mb-2.5 font-jua text-2xl leading-tight font-normal">{a.title}</h4>
{(q.data?.body ?? []).map((t) => (
+1 -3
View File
@@ -284,9 +284,7 @@ function SeasonBand({ news }: { news: BandArticle[] }) {
<Rail>
{news.map((a) => (
<button key={a.article_id} type="button" onClick={() => open({ type: 'article', articleId: a.article_id })} className="w-[200px] cursor-pointer overflow-hidden rounded-[22px] bg-white text-left shadow-[inset_0_-5px_0_var(--shade),0_8px_16px_rgb(40_48_74/0.06)]">
<span className={cx('grid h-[116px] place-items-center', `b-bg-${cardBg(a.icon, a.article_id)}`)}>
<Ic name={a.icon} className="w-[76px]" />
</span>
<Thumb image={a.image} icon={a.icon} credit={a.image_credit} className={cx('h-[116px]', `b-bg-${cardBg(a.icon, a.article_id)}`)} iconClassName="w-[76px]" />
<span className="block px-3 pt-2.5 pb-3">
<b className="block font-jua text-[16.5px] leading-snug font-normal">{a.title}</b>
<small className="text-[12.5px] font-semibold text-(--ink2)">{a.meta}</small>
+3 -3
View File
@@ -17,16 +17,16 @@ export function Credit({ text, className = 'right-1 bottom-1' }: { text: string;
return <small className={cx('pointer-events-none absolute z-[1] rounded-[5px] bg-[rgb(16_20_34/0.5)] px-1 py-px text-[9px] leading-tight font-semibold whitespace-nowrap text-white', className)}>{text}</small>
}
type ThumbProps = { image?: string | null; icon: string; credit?: string | null; className?: string; iconClassName?: string; children?: ReactNode }
type ThumbProps = { image?: string | null; icon: string; credit?: string | null; className?: string; iconClassName?: string; creditClassName?: string; children?: ReactNode }
/** 사진이 있으면 사진(+출처), 없거나 못 불러오면 아이콘 */
export function Thumb({ image, icon, credit, className, iconClassName, children }: ThumbProps) {
export function Thumb({ image, icon, credit, className, iconClassName, creditClassName, children }: ThumbProps) {
const [failed, setFailed] = useState<string | null>(null)
const photo = image && image !== failed ? image : null
return (
<span className={cx('relative grid place-items-center overflow-hidden', className)}>
{photo ? <img src={photo} alt="" loading="lazy" decoding="async" onError={() => setFailed(photo)} className="absolute inset-0 size-full object-cover" /> : <Ic name={icon} className={iconClassName} />}
{photo && credit && <Credit text={credit} />}
{photo && credit && <Credit text={credit} className={creditClassName} />}
{children}
</span>
)