import {useSite} from '@site/lib/site-context';
import type {InfoRow} from '@site/lib/derive';
import {infoView, ON_VALUES} from '@site/sections/EssentialInfoSection';
function Row({row}: {row: InfoRow}) {
const long = Boolean(row.note) || row.value.length > 24;
return (
{row.label}
{row.value}
{row.note && ` — ${row.note}`}
);
}
export function Info() {
const payload = useSite();
const view = infoView(payload);
if (!view) return null;
const {ruleRows, detailRows, amenities, notices} = view;
const short = ruleRows
.filter((row) => !row.note && row.value.length <= 24)
.sort((a, b) => Number(b.key === 'check_in_time') - Number(a.key === 'check_in_time'));
const long = ruleRows.filter((row) => row.note || row.value.length > 24);
const sorted = [...amenities].sort((a, b) => Number(ON_VALUES.has(b.value)) - Number(ON_VALUES.has(a.value)));
return (
<>
INFORMATION
이용안내
방문 전 확인이 필요한 운영 규정과 시설 안내입니다.
{ruleRows.length > 0 && (
<>
예약 전 확인
{[...short, ...long].map((row) => (
))}
>
)}
{detailRows.length + sorted.length > 0 && (
<>
시설 · 편의
{detailRows.map((row) => (
))}
{sorted.length > 0 && (
{sorted.map((row) => {
const on = ON_VALUES.has(row.value);
return (
-
{on ? '✓' : '✕'}
{row.label} {row.value}
);
})}
)}
>
)}
{notices.length > 0 && (
{notices.map((text) => (
예약 공지
{text}
))}
)}
>
);
}