Skip to content

Commit

Permalink
#379 Fix CSS issue on tooltip (apply max width and better style)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylchauf committed Jun 24, 2021
1 parent 098d463 commit 5438225
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions frontend/src/components/Map/components/Popup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import styled, { css } from 'styled-components';
import { Popup as LeafletPopup, Tooltip } from 'react-leaflet';
import { Popup as LeafletPopup, Tooltip as LeafletTooltip } from 'react-leaflet';
import { FormattedMessage } from 'react-intl';
import Loader from 'react-loader';

Expand Down Expand Up @@ -73,9 +73,9 @@ export const Popup: React.FC<Props> = ({ id, handleOpen, handleClose, type }) =>
return (
<>
{!hideTooltip && (
<Tooltip>
<StyledTooltip>
<PopupContent type={type} id={id} showButton={false} />
</Tooltip>
</StyledTooltip>
)}
<StyledPopup
closeButton={false}
Expand Down Expand Up @@ -117,6 +117,18 @@ const Title = styled.span`
`)}
`;

const StyledTooltip = styled(LeafletTooltip)`
padding: 0;
border: 0px !important;
border-radius: ${getSpacing(4)} !important;
overflow: hidden;
white-space: initial !important;
width: ${mobileWidth}px;
${desktopOnly(css`
width: ${desktopWidth}px;
`)};
`;

const StyledPopup = styled(LeafletPopup)`
.leaflet-popup-content {
margin: 0;
Expand Down

0 comments on commit 5438225

Please sign in to comment.