Skip to content

Commit 3378a89

Browse files
committed
fix: revert all day previous commit
1 parent a3627db commit 3378a89

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"engines": {
1414
"node": ">=12"
1515
},
16-
"type": "module",
1716
"eslintConfig": {
1817
"extends": [
1918
"react-app",
@@ -119,4 +118,4 @@
119118
"limit": "10 KB"
120119
}
121120
]
122-
}
121+
}

rollup.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ import autoprefixer from "autoprefixer";
1212
import path from 'path'
1313

1414
export default [
15+
// CommonJS
1516
{
1617
input: "src/index.tsx",
1718
external: ["./lib/style.css", "lodash"],
1819
output: {
1920
dir: "./",
2021
entryFileNames: "lib/cjs/index.js",
21-
format: "es",
22+
format: "cjs",
2223
globals:{
2324
"lodash": "_"
2425
}

src/controls/controls.tsx

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { FC, useContext, useState } from "react";
22
import ReactDOM from "react-dom";
33
import { MapContext } from "../map";
4+
import "../styles/controls.css";
45

56
export interface MapControlsProps {
67
templateGridStyle? : React.CSSProperties;
@@ -10,19 +11,6 @@ export const MapControls: FC<MapControlsProps> = ({ children, templateGridStyle
1011
const map = useContext(MapContext);
1112
const [overlay, setOverlay] = useState<Element | null>();
1213

13-
const customCssStyle: React.CSSProperties = {
14-
display: "grid",
15-
height: "100%",
16-
gridTemplateColumns: "1fr 1fr",
17-
gridTemplateRows: "1fr 1fr",
18-
gridTemplateAreas: "top-left top-right bottom-left bottom-right",
19-
alignContent: "space-between",
20-
justifyContent: "space-between",
21-
gap: "8px",
22-
padding: "8px",
23-
pointerEvents: "none",
24-
};
25-
2614
if (map && !overlay) {
2715
setOverlay(
2816
map
@@ -33,9 +21,12 @@ export const MapControls: FC<MapControlsProps> = ({ children, templateGridStyle
3321

3422
return overlay
3523
? ReactDOM.createPortal(
36-
<div style={{ ...templateGridStyle, ...customCssStyle }}>{children}</div>,
37-
overlay
38-
)
24+
<div className="controls" style={templateGridStyle}>
25+
{children}
26+
</div>,
27+
overlay
28+
)
29+
3930
: null;
4031
};
4132

src/controls/full-screen-control.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { FC, useContext, useEffect, useState } from "react";
22
import { FullScreen } from "ol/control";
33
import { Map } from "ol";
44
import { MapContext } from "../map/map-context";
5+
import style from "./control.css";
56

67
import screenfull from "screenfull";
78

@@ -73,7 +74,7 @@ export const FullScreenControl: FC<Props> = ({ CustomControl }) => {
7374
/>
7475
) : (
7576
<div
76-
style={{ position: "relative", width: "max-content" }}
77+
className={style.control}
7778
ref={(el) => {
7879
el && defaultControl && el.appendChild(defaultControl);
7980
}}

src/map/map.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import React, {
55
FunctionComponent,
66
MutableRefObject,
77
} from "react";
8+
import "../styles/map.css";
89
import { MapContext } from "./map-context";
910
import * as ol from "ol";
1011
import { useEvent } from "../events/use-event";

0 commit comments

Comments
 (0)