import type { Ref } from 'react' import { createPortal } from 'react-dom' import { cx } from '../lib/utils' import type { TopIndex } from '../api/client/types.gen' import { MEDALS, type TimeKind } from './lib' import { Ic } from './ui' /** 공유 이미지 전용 틀. 화면 밖에 그려 두고 보내기 때 이것만 찍는다 (화면의 버튼은 이미지에서 빠지므로 글자만으로 만든다) */ function Offscreen({ children }: { children: React.ReactNode }) { return createPortal( , document.body, ) } export type DayShare = { kind: TimeKind label: string now: boolean icon: string temp: string score?: number | null gak?: { name: string; icon: string } | null } function DayLabel({ d, size }: { d: DayShare; size: string }) { return ( {d.label} {d.now && 지금} ) } /** 히어로 공유: 아침·낮·저녁·밤 네 줄. 줄마다 그 시간대 하늘에 날씨·기온, 날씨 점수, 그 시간 1등 각. 로고·지역·날짜는 공유 틀이 그린다 */ export function DayShareCard({ days, ref }: { days: DayShare[]; ref: Ref }) { return (
{days.map((d) => (
{d.temp} {d.gak && } {d.gak?.name ?? '쉬어 가요'} {d.score ?? '–'} 날씨 점수
))}
) } /** 1:1 공유용: 같은 내용을 2×2 칸으로 */ export function DayShareGrid({ days, ref }: { days: DayShare[]; ref: Ref }) { return (
{days.map((d) => (
{d.temp} {d.score ?? '–'} 날씨 점수 {d.gak && } {d.gak?.name ?? '쉬어 가요'}
))}
) } export function GakShareCard({ items, title, ref }: { items: TopIndex[]; title: string; ref: Ref }) { return (

{title}

    {items.map((g, i) => (
  1. {i < 3 ? : {i + 1}} {g.name} {g.summary && {g.summary}} {g.score}
  2. ))}
) }