Skip to content

Commit

Permalink
Set interactiv map height to window innerheight, ref #272831
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Jul 23, 2024
1 parent d99c3dc commit 5ac9eb5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/EmbedMap/EmbedMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ const messages = defineMessages({
},
});

function getHeight(height) {
function getHeight(height, screen) {
const asNumber = isNumber(Number(height)) && !isNaN(Number(height));
if (asNumber) {
return `${height}px`;
}
return height;
return height || screen.page.height - 50;
}

function EmbedMap({ data, intl, id, screen }) {
Expand Down Expand Up @@ -78,16 +78,17 @@ function EmbedMap({ data, intl, id, screen }) {
<PrivacyProtection
data={data}
id={id}
height={getHeight(data.height)}
height={getHeight(data.height, screen)}
useVisibilitySensor={data.useVisibilitySensor ?? true}
>
<iframe
id="my-iframe"
title={intl.formatMessage(messages.EmbededESRIMaps)}
src={iframeSrc}
className="google-map"
frameBorder="0"
allowFullScreen
style={data.height ? { height: getHeight(data.height) } : {}}
style={{ height: getHeight(data.height, screen) }}
/>
</PrivacyProtection>
</div>
Expand Down

0 comments on commit 5ac9eb5

Please sign in to comment.