import {useState} from 'react'; import {Car, Check, Copy, Navigation} from 'lucide-react'; import {useSite} from '@site/lib/site-context'; import {kakaoDirectionsUrl, naverDirectionsUrl, osmEmbedUrl, tmapDirectionsUrl} from '@site/lib/format'; import {Section} from '@site/lib/ui'; /** * 오시는 길. * * ★ 지도를 폭 전체에 눕히지 않는다. 16:9 지도가 1200px 폭을 차지하면 세로 675px 짜리 * 빈 회색 판이 화면 하나를 통째로 먹고, 정작 주소와 길찾기 버튼은 그 아래로 밀렸다. * 넓은 화면에서는 지도(7) 옆에 주소·길찾기·소요시간(5)을 세운다. * * ★ 네이버 초록·카카오 노랑은 템플릿 색으로 바꾸지 않는다 — 그건 디자인이 아니라 * 남의 서비스 식별색이다. 손님은 색으로 버튼을 찾는다. */ export function LocationSection() { const payload = useSite(); const {place, routes} = payload; const [copied, setCopied] = useState(false); const address = place.roadAddress ?? place.address; if (!address) return null; // 좌표가 있어야 지도도 길찾기도 정확해진다. 없으면 지도를 그리지 않고, // 버튼은 검색으로 떨어진다(format.ts) — 틀린 핀을 찍느니 안 찍는다. const {latitude: lat, longitude: lng} = place; const hasGeo = lat != null && lng != null; const tmap = tmapDirectionsUrl(place.name, lat, lng); const handleCopy = async () => { try { await navigator.clipboard.writeText(address); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { // 클립보드 권한이 없으면 조용히 넘어간다 — 주소는 화면에 그대로 있다. } }; return (
{hasGeo && (
{/* ★ loading="lazy" — 지도는 접힌 화면 아래에 있는 경우가 많고, 첫 화면 속도를 남의 서버 응답에 맡기지 않는다. title 은 스크린리더가 읽을 유일한 설명이다. */}