mirror of
https://github.com/jlengrand/leaflet-geosearch.git
synced 2026-03-10 08:31:26 +00:00
fix docz production build
This commit is contained in:
@@ -1,18 +0,0 @@
|
|||||||
html, body {
|
|
||||||
font-family: 'Open Sans', sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
*, *:before, *:after {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
:global(.leaflet-control-geosearch.bar) {
|
|
||||||
position: absolute !important;
|
|
||||||
left: 50px;
|
|
||||||
right: 515px;
|
|
||||||
}
|
|
||||||
@@ -1,9 +1,4 @@
|
|||||||
.root {
|
.map {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.map {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import React, { ReactElement, useRef, useEffect } from 'react';
|
import React, { ReactElement, useRef, useEffect } from 'react';
|
||||||
import 'leaflet/dist/leaflet.css';
|
import 'leaflet/dist/leaflet.css';
|
||||||
import { Map, TileLayer } from 'react-leaflet';
|
import { Map, TileLayer } from 'react-leaflet';
|
||||||
import styles from './Leaflet.module.css';
|
|
||||||
import '../../assets/css/leaflet.css';
|
import '../../assets/css/leaflet.css';
|
||||||
import useConfigureLeaflet from '../hooks/useConfigureLeaflet';
|
import useConfigureLeaflet from '../hooks/useConfigureLeaflet';
|
||||||
import * as providers from '../../src/providers';
|
import * as providers from '../../src/providers';
|
||||||
import GeoSearchControl from '../../src/leafletControl';
|
import GeoSearchControl from '../../src/leafletControl';
|
||||||
|
import styles from './Leaflet.module.css';
|
||||||
|
|
||||||
import { MapProps } from './Map';
|
import { MapProps } from './Map';
|
||||||
|
|
||||||
@@ -55,9 +56,11 @@ function Leaflet(props: MapProps): ReactElement {
|
|||||||
};
|
};
|
||||||
}, [ref.current, control.current, provider]);
|
}, [ref.current, control.current, provider]);
|
||||||
|
|
||||||
|
// I'm not sure what's causing it, but the className from the outer
|
||||||
|
// div is being removed. Hence the useless wrapper
|
||||||
return (
|
return (
|
||||||
<div className={styles.root}>
|
<div>
|
||||||
<Map ref={ref} viewport={viewport} className={styles.map}>
|
<Map ref={ref} viewport={viewport} id="map" className={styles.map}>
|
||||||
<TileLayer url="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
<TileLayer url="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
|
||||||
</Map>
|
</Map>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
import React, { ReactElement, lazy, Suspense } from 'react';
|
import React, { ReactElement } from 'react';
|
||||||
import 'leaflet/dist/leaflet.css';
|
import Leaflet from './Leaflet';
|
||||||
|
|
||||||
const Leaflet = lazy(() => import('./Leaflet'));
|
|
||||||
const Loader = () => <div>loading...</div>;
|
|
||||||
|
|
||||||
export interface MapProps {
|
export interface MapProps {
|
||||||
provider: 'OpenStreetMap' | 'Google' | 'Bing';
|
provider?: 'OpenStreetMap' | 'Google' | 'Bing';
|
||||||
providerOptions: any;
|
providerOptions: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Map(props: MapProps): ReactElement {
|
function Map(props: MapProps): ReactElement {
|
||||||
return (
|
if (typeof window === 'undefined') {
|
||||||
<Suspense fallback={<Loader />}>
|
return <div>loading...</div>;
|
||||||
<Leaflet provider={props.provider} />
|
}
|
||||||
</Suspense>
|
|
||||||
);
|
return <Leaflet provider={props.provider} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Map;
|
export default Map;
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
|
|
||||||
import isDomAvailable from '../lib/isDomAvailable';
|
|
||||||
import { Viewport } from 'react-leaflet';
|
import { Viewport } from 'react-leaflet';
|
||||||
|
|
||||||
const viewport: Viewport = {
|
const viewport: Viewport = {
|
||||||
@@ -13,7 +11,7 @@ export interface LeafletConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const useConfigureLeaflet = (): LeafletConfig => {
|
const useConfigureLeaflet = (): LeafletConfig => {
|
||||||
if (!isDomAvailable()) return;
|
if (!window) return;
|
||||||
|
|
||||||
// To get around an issue with the default icon not being set up right between using React
|
// To get around an issue with the default icon not being set up right between using React
|
||||||
// and importing the leaflet library, we need to reset the image imports
|
// and importing the leaflet library, we need to reset the image imports
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Although this project is named `leaflet-geosearch`, this library is also usable
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install --save leaflet-geosearch
|
npm install leaflet-geosearch
|
||||||
```
|
```
|
||||||
|
|
||||||
## Providers
|
## Providers
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default {
|
|||||||
},
|
},
|
||||||
src: 'docs',
|
src: 'docs',
|
||||||
dest: '.docz/dist',
|
dest: '.docz/dist',
|
||||||
public: 'assets',
|
public: 'docs/assets',
|
||||||
ignore: ['CODE_OF_CONDUCT.md', 'CONTRIBUTING.md', 'LICENSE.md'],
|
ignore: ['CODE_OF_CONDUCT.md', 'CONTRIBUTING.md', 'LICENSE.md'],
|
||||||
menu: [
|
menu: [
|
||||||
{ name: 'Introduction' },
|
{ name: 'Introduction' },
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
import './static/assets/css/docs.css';
|
import './static/docs/assets/css/global.css';
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
require('dotenv').config({
|
require('dotenv').config({
|
||||||
path: '.env',
|
path: '.env',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
resolve: 'gatsby-plugin-react-leaflet',
|
||||||
|
options: {
|
||||||
|
linkStyles: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
exports.onCreateWebpackConfig = ({ stage, rules, loaders, actions }) => {
|
|
||||||
switch (stage) {
|
|
||||||
case 'build-html':
|
|
||||||
actions.setWebpackConfig({
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /react-leaflet|leaflet/,
|
|
||||||
use: [loaders.null()],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
|
const tsConfig = require('./tsconfig.json');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
preset: 'ts-jest',
|
preset: 'ts-jest',
|
||||||
testEnvironment: 'jsdom',
|
testEnvironment: 'jsdom',
|
||||||
@@ -12,4 +15,13 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
automock: false,
|
automock: false,
|
||||||
setupFiles: ['./jest.setup.js'],
|
setupFiles: ['./jest.setup.js'],
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
tsConfig: {
|
||||||
|
...tsConfig.compilerOptions,
|
||||||
|
noEmit: false,
|
||||||
|
outDir: '.tsCache',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
4658
package-lock.json
generated
4658
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -24,9 +24,6 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"example": "example"
|
"example": "example"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
|
||||||
"docz/**/webpack": "4.28.4"
|
|
||||||
},
|
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"geolocation",
|
"geolocation",
|
||||||
"geocoding",
|
"geocoding",
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"target":"es2015",
|
||||||
"noImplicitAny": true,
|
"module": "CommonJS",
|
||||||
"removeComments": true,
|
"moduleResolution": "node",
|
||||||
"preserveConstEnums": true,
|
"resolveJsonModule": true,
|
||||||
"outFile": "./dist/tsc.js",
|
|
||||||
"sourceMap": true,
|
|
||||||
"allowJs": true,
|
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"noUnusedLocals": true,
|
"noEmit": true,
|
||||||
"jsx": "preserve",
|
"jsx": "react",
|
||||||
"target": "ES5",
|
"inlineSourceMap": true,
|
||||||
"outDir": ".tsout"
|
"allowJs": true,
|
||||||
|
"pretty": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": false
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*",
|
"src/**/*",
|
||||||
|
|||||||
Reference in New Issue
Block a user