)
}
// 보이는 크기는 두고 누르는 영역만 가운데 44×44로 넓힌다 (위치 지정된 요소에 붙인다)
export const TAP44 = 'after:absolute after:top-1/2 after:left-1/2 after:size-11 after:-translate-1/2'
type ChipsProps = { items: readonly (readonly [K, string])[]; value: K; onChange: (k: K) => void; label: string; disabled?: boolean }
export function Chips({ items, value, onChange, label, disabled }: ChipsProps) {
return (
{items.map(([k, l]) => (
))}
)
}
function ChipStrip({ children, label }: { children: ReactNode; label: string }) {
const { ref, api, prev, next } = useCarousel(STRIP)
return (
{children}
)
}
type SkelProps = { className?: string; shape?: boolean; style?: CSSProperties }
/**
* 불러오는 동안 자리만 잡는 막대. 기본은 글자 자리: 감싼 글자 요소 안에 넣으면 그 줄 높이(1lh)를 그대로 차지한다.
* shape 면 className 으로 준 크기의 블록(사진·동그라미 자리).
*/
export function Skel({ className, shape = false, style }: SkelProps) {
return (
)
}
type StateProps = { load: Load; onRetry?: () => void; empty?: string; className?: string; hold?: ReactNode }
/**
* 실패·빈 목록 안내. 불러오는 중엔 그리지 않는다(그 자리는 스켈레톤).
* hold 에 스켈레톤을 주면 그 크기를 보이지 않게 깔고 안내를 그 위에 띄운다 — 로딩·실패·빈 상태의 자리 크기가 같다.
* 이때 className 은 안내 상자의 위치(스켈레톤 바깥 여백만큼 inset).
*/
export function StateBox({ load, onRetry, empty, className, hold }: StateProps) {
const failed = load === 'error' || load === 'retrying'
const text = failed ? '정보를 불러오지 못했어요.' : load === 'ready' ? empty : undefined
if (!text) return null
const box = (
{text}
{failed && onRetry && (
)}
)
if (!hold) return box
return (
{hold}
{box}
)
}
/** 줄 목록 (라벨 · 값) */
/** 위치가 정해진 장소 이름. 누르면 네이버 지도가 새 탭으로 열린다 */
export function MapLink({ place, children, className }: { place: string; children: ReactNode; className?: string }) {
return (
{children}
)
}
export function Rows({ rows, dark = false }: { rows: { label: string; value: string; place?: string | null }[]; dark?: boolean }) {
return (