mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Add leaflet-powered brewery map
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Link } from 'react-router';
|
||||
import type { Brewery } from '../breweries.server';
|
||||
import { formatBreweryAddress } from '../utils/format-address';
|
||||
|
||||
interface BreweryCardProps {
|
||||
brewery: Brewery;
|
||||
@@ -12,13 +13,32 @@ const BreweryCard = ({ brewery }: BreweryCardProps) => (
|
||||
>
|
||||
<div className="card-body">
|
||||
<h2 className="card-title">{brewery.breweryName}</h2>
|
||||
<p className="text-base-content/70 line-clamp-3">{brewery.description}</p>
|
||||
{brewery.location && (
|
||||
<p className="text-sm font-medium text-base-content/70">
|
||||
{brewery.location.cityName}, {brewery.location.stateProvinceCode}
|
||||
</p>
|
||||
)}
|
||||
{brewery.description && (
|
||||
<p className="text-sm leading-5 text-base-content/70 line-clamp-2 max-h-10 overflow-hidden">
|
||||
{brewery.description}
|
||||
</p>
|
||||
)}
|
||||
{brewery.location && (
|
||||
<p className="text-sm text-base-content/50 mt-2">
|
||||
{brewery.location.addressLine1}
|
||||
{brewery.location.addressLine2 ? `, ${brewery.location.addressLine2}` : ''}
|
||||
{formatBreweryAddress(brewery.location)}
|
||||
</p>
|
||||
)}
|
||||
{brewery.location?.coordinates && (
|
||||
<a
|
||||
href={`https://www.openstreetmap.org/?mlat=${brewery.location.coordinates.latitude}&mlon=${brewery.location.coordinates.longitude}#map=16/${brewery.location.coordinates.latitude}/${brewery.location.coordinates.longitude}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="link link-primary text-sm mt-2 self-start"
|
||||
>
|
||||
View on map →
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user