Skip to content

Commit

Permalink
fix: add support for the maxWidth option of MapboxGL's Popup. (h/t @W…
Browse files Browse the repository at this point in the history
WesWedding authored Apr 26, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d70126b commit c6101c1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Popup/index.js
Original file line number Diff line number Diff line change
@@ -52,7 +52,10 @@ type Props = {
offset?: MapboxLngLatBoundsLike,

/** The className of the popup */
className?: string
className?: string,

/** A string that sets the CSS property of the popup's maximum width. */
maxWidth?: string
};

class Popup extends PureComponent<Props> {
@@ -70,7 +73,8 @@ class Popup extends PureComponent<Props> {
onClose: null,
anchor: null,
offset: null,
className: null
className: null,
maxWidth: '240px'
};

constructor(props: Props) {
@@ -87,15 +91,17 @@ class Popup extends PureComponent<Props> {
closeOnClick,
onClose,
anchor,
className
className,
maxWidth
} = this.props;

this._popup = new mapboxgl.Popup({
offset,
closeButton,
closeOnClick,
anchor,
className
className,
maxWidth
});

this._popup.setDOMContent(this._el);

0 comments on commit c6101c1

Please sign in to comment.