-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from Georiviere/map_interactions
Map interactions enhancements
- Loading branch information
Showing
6 changed files
with
243 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import Image from 'next/image'; | ||
import { Layer } from '@/api/settings'; | ||
import { GeoJsonProperties } from 'geojson'; | ||
import { Tooltip } from 'react-leaflet'; | ||
|
||
import { MetadataList } from '../metadata-list'; | ||
|
||
export const GeometryTooltip = ({ | ||
properties, | ||
layer, | ||
}: { | ||
properties: GeoJsonProperties; | ||
layer: Layer; | ||
}) => { | ||
if (properties === null || (!properties.name && !properties.category)) { | ||
return null; | ||
} | ||
if (layer.type === undefined || !layer.url || !properties.id) { | ||
return <Tooltip>{properties.name ?? properties.category}</Tooltip>; | ||
} | ||
return ( | ||
<Tooltip | ||
sticky | ||
className="w-64 !overflow-hidden !whitespace-normal !rounded-xl !border-0 !p-0" | ||
> | ||
<div className="flex flex-col"> | ||
{properties.attachments?.[0]?.thumbnail && ( | ||
<Image | ||
loading="lazy" | ||
className="aspect-[4/3] h-auto w-auto object-cover transition-all group-hover:scale-105" | ||
src={properties.attachments[0].thumbnail} | ||
alt="" | ||
width="400" | ||
height="300" | ||
/> | ||
)} | ||
<div className="p-4"> | ||
<h3 className="line-clamp-2 text-lg font-bold"> | ||
{properties.name ?? properties.category} | ||
</h3> | ||
<MetadataList | ||
descent={properties.descent} | ||
flow={properties.flow} | ||
length={properties.length} | ||
type={properties.type} | ||
small | ||
/> | ||
{properties.description && ( | ||
<span | ||
className="mb-1 line-clamp-2" | ||
dangerouslySetInnerHTML={{ __html: properties.description }} | ||
></span> | ||
)} | ||
</div> | ||
</div> | ||
</Tooltip> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.