Skip to content

Commit

Permalink
feat: 장소아이템 컴포넌트 구현 #16
Browse files Browse the repository at this point in the history
  • Loading branch information
1119wj committed Nov 9, 2024
1 parent 162faf5 commit d16a680
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions frontend/src/components/Place/PlaceItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { useGoogleMapStore } from '@/store/googleMapState';
import { Place } from '@/types';

const PlaceItem = ({ place }: { place: Place }) => {
const moveToLocation = useGoogleMapStore((state) => state.moveTo);
const location = place.location;

const onPlaceClick = () => {
moveToLocation(location.lat, location.lng);
};

return (
<div
onClick={onPlaceClick}
className="flex items-center border-b border-gray-200 p-4"
>
<img
src={place.thumbnail_url}
alt={place.name}
className="h-16 w-16 rounded-md"
/>
<div className="ml-4">
<h4 className="text-lg font-semibold">{place.name}</h4>
<p className="text-gray-500">{place.formed_address}</p>
<div className="text-yellow-500">{place.rating} ⭐️</div>
</div>
</div>
);
};

export default PlaceItem;

0 comments on commit d16a680

Please sign in to comment.