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

+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>
)