This commit is contained in:
eric
2026-03-16 06:53:23 -05:00
parent c54d46517c
commit c54c236d1b
13 changed files with 538 additions and 359 deletions

View File

@@ -8,12 +8,16 @@ interface AddressLinkProps {
className?: string;
}
/** 红山地址展示:龙华区 | 🚇红山地铁站 | Loft民宿 */
const HONGSHAN_DISPLAY = "龙华区 | 🚇 红山地铁站 | Loft民宿";
/** 可点击的地址,点击打开地图(使用 span 避免嵌套在 Link 内时的 a 标签冲突) */
export default function AddressLink({ place, city, className = "" }: AddressLinkProps) {
const isHongshan = place.includes("红山");
const mapUrl = isHongshan
? `https://www.google.com/maps?q=${HONGSHAN_COORDS.lat},${HONGSHAN_COORDS.lng}`
: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(`${city}${place}`)}`;
? `https://api.map.baidu.com/marker?location=${HONGSHAN_COORDS.lat},${HONGSHAN_COORDS.lng}&title=${encodeURIComponent(place)}&output=html`
: `https://map.baidu.com/search?query=${encodeURIComponent(`${city}${place}`)}`;
const displayText = isHongshan ? HONGSHAN_DISPLAY : place;
return (
<span
@@ -35,7 +39,7 @@ export default function AddressLink({ place, city, className = "" }: AddressLink
title="点击打开地图"
>
<span className="inline-block" aria-hidden>📍</span>
{place}
{displayText}
</span>
);
}