Truncate long map hover captions
This commit is contained in:
parent
c2a0e1585f
commit
b4b89fcd37
@ -21,17 +21,22 @@ export default function PlaceEntity({
|
||||
hoverKey: place.id,
|
||||
content: <div className="relative">
|
||||
<PlaceMap {...{ place, width, height }} />
|
||||
<span
|
||||
className={clsx(
|
||||
'absolute bottom-2.5 left-2.5',
|
||||
'px-1.5 py-0.5 rounded-sm',
|
||||
'text-white/90 bg-black/40 backdrop-blur-lg',
|
||||
'outline-medium shadow-sm',
|
||||
'uppercase text-[0.7rem]',
|
||||
)}
|
||||
>
|
||||
{place.nameFormatted || place.name}
|
||||
</span>
|
||||
<div className={clsx(
|
||||
'absolute bottom-2.5 left-2.5 right-2.5',
|
||||
'flex',
|
||||
)}>
|
||||
<span
|
||||
className={clsx(
|
||||
'px-1.5 py-0.5 rounded-sm',
|
||||
'text-white/90 bg-black/40 backdrop-blur-lg',
|
||||
'outline-medium shadow-sm',
|
||||
'uppercase text-[0.7rem]',
|
||||
'truncate',
|
||||
)}
|
||||
>
|
||||
{place.nameFormatted || place.name}
|
||||
</span>
|
||||
</div>
|
||||
</div>,
|
||||
className: 'inline-flex',
|
||||
width,
|
||||
|
||||
@ -2,15 +2,15 @@ const DEFAULT_ASPECT_RATIO = 3.0 / 2.0;
|
||||
|
||||
export const getDimensionsFromSize = (
|
||||
size: number,
|
||||
aspectRatioRaw?: string | number,
|
||||
_aspectRatio?: string | number,
|
||||
): {
|
||||
width: number
|
||||
height: number
|
||||
aspectRatio: number
|
||||
} => {
|
||||
const aspectRatio = typeof aspectRatioRaw === 'string'
|
||||
? parseFloat(aspectRatioRaw)
|
||||
: aspectRatioRaw || DEFAULT_ASPECT_RATIO;
|
||||
const aspectRatio = typeof _aspectRatio === 'string'
|
||||
? parseFloat(_aspectRatio)
|
||||
: _aspectRatio || DEFAULT_ASPECT_RATIO;
|
||||
|
||||
let width = size;
|
||||
let height = size;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user