From bdab39d866f7b0958a9db0b04411633342c7e06e Mon Sep 17 00:00:00 2001 From: kurihada Date: Tue, 24 Feb 2026 17:22:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8D=A1=E7=89=87=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=AB=98=E5=BE=B7=E8=AF=A6=E6=83=85=E5=92=8C=E5=A4=A7=E4=BC=97?= =?UTF-8?q?=E7=82=B9=E8=AF=84=E5=A4=96=E9=93=BE=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/RestaurantCard.tsx | 47 ++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/components/RestaurantCard.tsx b/src/components/RestaurantCard.tsx index bd8a112..66147b3 100644 --- a/src/components/RestaurantCard.tsx +++ b/src/components/RestaurantCard.tsx @@ -1,13 +1,30 @@ "use client"; -import { Star, MapPin, Clock } from "lucide-react"; +import { useCallback } from "react"; +import { Star, MapPin, Clock, ExternalLink } from "lucide-react"; import { Restaurant } from "@/types"; interface RestaurantCardProps { restaurant: Restaurant; } +function stopAll(e: React.SyntheticEvent) { + e.stopPropagation(); +} + export default function RestaurantCard({ restaurant }: RestaurantCardProps) { + const openLink = useCallback( + (url: string) => (e: React.MouseEvent | React.TouchEvent) => { + e.stopPropagation(); + e.preventDefault(); + window.open(url, "_blank", "noopener,noreferrer"); + }, + [], + ); + + const amapUrl = `https://uri.amap.com/poidetail?poiid=${restaurant.id}`; + const dianpingUrl = `https://m.dianping.com/search/keyword/0/0_${encodeURIComponent(restaurant.name)}`; + return (
@@ -28,9 +45,31 @@ export default function RestaurantCard({ restaurant }: RestaurantCardProps) {
-

- {restaurant.name} -

+
+

+ {restaurant.name} +

+
+ + +
+