Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

fix: convert icon components from class to functional to resolve defaultProps deprecation (#2912) (#3325)

pierreeurope3150b8c06f20
diff --git a/src/cloud-providers/src/base.tsx b/src/cloud-providers/src/base.tsx
index 674fb04a9..efd12975c 100644
--- a/src/cloud-providers/src/base.tsx
+++ b/src/cloud-providers/src/base.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component, CSSProperties} from 'react';
+import React, {CSSProperties} from 'react';
const getStyleClassFromColor = (totalColor: number, colors: string[]) =>
new Array(totalColor)
@@ -12,6 +12,10 @@ const nop = () => {
return;
};
+const DEFAULT_STYLE: CSSProperties = {
+ fill: 'currentColor'
+};
+
export type BaseProps = {
/** Set the height of the icon, ex. '16px' */
height?: string;
@@ -29,52 +33,38 @@ export type BaseProps = {
} & React.SVGAttributes<SVGSVGElement> &
React.DOMAttributes<SVGSVGElement>;
-export class Base extends Component<BaseProps> {
- static displayName = 'Base Icon';
+export const Base: React.FC<BaseProps> = ({
+ height = undefined,
+ width = undefined,
+ viewBox = '0 0 64 64',
+ style = DEFAULT_STYLE,
+ children,
+ predefinedClassName = '',
+ className = '',
+ colors,
+ totalColor,
+ ...props
+}) => {
+ const svgHeight = height;
+ const svgWidth = width || svgHeight;
- static defaultProps = {
- height: null,
- width: null,
- viewBox: '0 0 64 64',
- predefinedClassName: '',
- className: '',
- style: {
- fill: 'currentColor'
- }
- };
+ const fillStyle =
+ Array.isArray(colors) && totalColor && getStyleClassFromColor(totalColor, colors);
- render() {
- const {
- height,
- width,
- viewBox,
- style,
- children,
- predefinedClassName,
- className,
- colors,
- totalColor,
- ...props
- } = this.props;
- const svgHeight = height;
- const svgWidth = width || svgHeight;
-
- const fillStyle =
- Array.isArray(colors) && totalColor && getStyleClassFromColor(totalColor, colors);
+ return (
+ <svg
+ viewBox={viewBox}
+ width={svgWidth}
+ height={svgHeight}
+ style={style}
+ className={`${predefinedClassName} ${className}`}
+ onClick={nop}
+ {...props}
+ >
+ {fillStyle ? <style type="text/css">{fillStyle}</style> : null}
+ {children}
+ </svg>
+ );
+};
- return (
- <svg
- viewBox={viewBox}
- width={svgWidth}
- height={svgHeight}
- style={style}
- className={`${predefinedClassName} ${className}`}
- onClick={nop}
- {...props}
- >
- {fillStyle ? <style type="text/css">{fillStyle}</style> : null}
- {children}
- </svg>
- );
- }
-}
+Base.displayName = 'Base Icon';
diff --git a/src/cloud-providers/src/upload.tsx b/src/cloud-providers/src/upload.tsx
index b8ab5e8db..87533c347 100644
--- a/src/cloud-providers/src/upload.tsx
+++ b/src/cloud-providers/src/upload.tsx
@@ -1,20 +1,17 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
+import React from 'react';
import {Base, BaseProps} from './base';
-export default class Upload extends Component<Partial<BaseProps>> {
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'data-ex-icons-upload'
- };
+const Upload: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'data-ex-icons-upload',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} {...props}>
+ <path d="M52 9v6a1 1 0 0 1-1 1H13a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h38a1 1 0 0 1 1 1zm-4 31L34.426 21.336a3 3 0 0 0-4.852 0L16 40h8v16h16V40h8z" />
+ </Base>
+);
- render() {
- return (
- <Base {...this.props}>
- <path d="M52 9v6a1 1 0 0 1-1 1H13a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h38a1 1 0 0 1 1 1zm-4 31L34.426 21.336a3 3 0 0 0-4.852 0L16 40h8v16h16V40h8z" />
- </Base>
- );
- }
-}
+export default Upload;
diff --git a/src/layers/src/arc-layer/arc-layer-icon.tsx b/src/layers/src/arc-layer/arc-layer-icon.tsx
index d3a545a2a..6eb4a99ad 100644
--- a/src/layers/src/arc-layer/arc-layer-icon.tsx
+++ b/src/layers/src/arc-layer/arc-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-class ArcLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'point-layer-icon',
- totalColor: 4
- };
-
- render() {
- return (
- <Base {...this.props}>
+const ArcLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'point-layer-icon',
+ totalColor = 4,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path
d="M34.5,34.4c-0.6,0-1.2-0.4-1.4-1c-2.7-9.9-8.8-21.7-16.8-22.3c-3.1-0.2-5.6,1.5-7,4.8c-0.3,0.7-1.1,1.1-1.9,0.7
c-0.7-0.3-1.1-1.1-0.7-1.9c1.9-4.3,5.6-6.8,9.8-6.5c9.5,0.7,16.3,13,19.4,24.4c0.2,0.8-0.2,1.5-1,1.7C34.8,34.3,34.6,34.4,34.5,34.4
@@ -43,8 +33,6 @@ class ArcLayerIcon extends Component {
className="cr4"
/>
</Base>
- );
- }
-}
+);
export default ArcLayerIcon;
diff --git a/src/layers/src/base.tsx b/src/layers/src/base.tsx
index 674fb04a9..efd12975c 100644
--- a/src/layers/src/base.tsx
+++ b/src/layers/src/base.tsx
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component, CSSProperties} from 'react';
+import React, {CSSProperties} from 'react';
const getStyleClassFromColor = (totalColor: number, colors: string[]) =>
new Array(totalColor)
@@ -12,6 +12,10 @@ const nop = () => {
return;
};
+const DEFAULT_STYLE: CSSProperties = {
+ fill: 'currentColor'
+};
+
export type BaseProps = {
/** Set the height of the icon, ex. '16px' */
height?: string;
@@ -29,52 +33,38 @@ export type BaseProps = {
} & React.SVGAttributes<SVGSVGElement> &
React.DOMAttributes<SVGSVGElement>;
-export class Base extends Component<BaseProps> {
- static displayName = 'Base Icon';
+export const Base: React.FC<BaseProps> = ({
+ height = undefined,
+ width = undefined,
+ viewBox = '0 0 64 64',
+ style = DEFAULT_STYLE,
+ children,
+ predefinedClassName = '',
+ className = '',
+ colors,
+ totalColor,
+ ...props
+}) => {
+ const svgHeight = height;
+ const svgWidth = width || svgHeight;
- static defaultProps = {
- height: null,
- width: null,
- viewBox: '0 0 64 64',
- predefinedClassName: '',
- className: '',
- style: {
- fill: 'currentColor'
- }
- };
+ const fillStyle =
+ Array.isArray(colors) && totalColor && getStyleClassFromColor(totalColor, colors);
- render() {
- const {
- height,
- width,
- viewBox,
- style,
- children,
- predefinedClassName,
- className,
- colors,
- totalColor,
- ...props
- } = this.props;
- const svgHeight = height;
- const svgWidth = width || svgHeight;
-
- const fillStyle =
- Array.isArray(colors) && totalColor && getStyleClassFromColor(totalColor, colors);
+ return (
+ <svg
+ viewBox={viewBox}
+ width={svgWidth}
+ height={svgHeight}
+ style={style}
+ className={`${predefinedClassName} ${className}`}
+ onClick={nop}
+ {...props}
+ >
+ {fillStyle ? <style type="text/css">{fillStyle}</style> : null}
+ {children}
+ </svg>
+ );
+};
- return (
- <svg
- viewBox={viewBox}
- width={svgWidth}
- height={svgHeight}
- style={style}
- className={`${predefinedClassName} ${className}`}
- onClick={nop}
- {...props}
- >
- {fillStyle ? <style type="text/css">{fillStyle}</style> : null}
- {children}
- </svg>
- );
- }
-}
+Base.displayName = 'Base Icon';
diff --git a/src/layers/src/cluster-layer/cluster-layer-icon.tsx b/src/layers/src/cluster-layer/cluster-layer-icon.tsx
index 67dab33ac..8bf8a8675 100644
--- a/src/layers/src/cluster-layer/cluster-layer-icon.tsx
+++ b/src/layers/src/cluster-layer/cluster-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-class ClusterLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'cluster-layer-icon',
- totalColor: 5
- };
-
- render() {
- return (
- <Base {...this.props}>
+const ClusterLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'cluster-layer-icon',
+ totalColor = 5,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path
d="M13.6,22.7c2.9-3.6,4.4-6.3,4.4-8c0-2.7-2.2-4.9-4.9-4.9S8.2,12,8.2,14.7c0,1.7,1.5,4.4,4.4,8l0,0
C12.8,23,13.2,23,13.6,22.7C13.5,22.8,13.6,22.7,13.6,22.7z"
@@ -47,8 +37,6 @@ class ClusterLayerIcon extends Component {
className="cr5"
/>
</Base>
- );
- }
-}
+);
export default ClusterLayerIcon;
diff --git a/src/layers/src/default-layer-icon.tsx b/src/layers/src/default-layer-icon.tsx
index 0526e9b3a..24de4b201 100644
--- a/src/layers/src/default-layer-icon.tsx
+++ b/src/layers/src/default-layer-icon.tsx
@@ -1,24 +1,15 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from './base';
+import React from 'react';
+import {Base, BaseProps} from './base';
-class DefaultLayerIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'default-layer-icon'
- };
-
- render() {
- return (
- <Base {...this.props}>
+const DefaultLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'default-layer-icon',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} {...props}>
<circle cx="29.4" cy="31.6" r="8.4" />
<circle cx="48.5" cy="15.7" r="6.5" />
<circle cx="11" cy="44.2" r="3" />
@@ -26,8 +17,6 @@ class DefaultLayerIcon extends Component {
<circle cx="34" cy="54.2" r="3" />
<circle cx="14" cy="16.2" r="4" />
</Base>
- );
- }
-}
+);
export default DefaultLayerIcon;
diff --git a/src/layers/src/geojson-layer/geojson-layer-icon.tsx b/src/layers/src/geojson-layer/geojson-layer-icon.tsx
index ecc6e937e..92a2288a1 100644
--- a/src/layers/src/geojson-layer/geojson-layer-icon.tsx
+++ b/src/layers/src/geojson-layer/geojson-layer-icon.tsx
@@ -1,26 +1,15 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class GeojsonLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: null,
- size: 'tiny',
- predefinedClassName: 'geojson-layer-icon'
- };
-
- render() {
- return (
- <Base {...this.props}>
+const GeojsonLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = undefined,
+ predefinedClassName = 'geojson-layer-icon',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} {...props}>
<polygon
className="cr1"
points="25.04 23.08 9.72 31.79 8.19 43.2 19.57 53.83 28.79 53.83 35.6 46.57 39.45 30.08 25.04 23.08"
@@ -46,6 +35,6 @@ export default class GeojsonLayerIcon extends Component {
style={{opacity: 0.8}}
/>
</Base>
- );
- }
-}
+);
+
+export default GeojsonLayerIcon;
diff --git a/src/layers/src/grid-layer/grid-layer-icon.tsx b/src/layers/src/grid-layer/grid-layer-icon.tsx
index 965dc0b7a..569c47a27 100644
--- a/src/layers/src/grid-layer/grid-layer-icon.tsx
+++ b/src/layers/src/grid-layer/grid-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class GridLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'grid-layer-icon',
- totalColor: 6
- };
-
- render() {
- return (
- <Base {...this.props}>
+const GridLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'grid-layer-icon',
+ totalColor = 6,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<rect x="11.2" y="11.2" className="cr1" width="13.1" height="13.1" style={{opacity: 0.8}} />
<rect x="25.4" y="11.2" className="cr2" width="13.1" height="13.1" style={{opacity: 0.8}} />
<rect x="39.6" y="11.2" width="13.1" height="13.1" className="cr3" />
@@ -31,6 +21,6 @@ export default class GridLayerIcon extends Component {
<rect x="25.4" y="39.6" className="cr2" width="13.1" height="13.1" style={{opacity: 0.4}} />
<rect x="39.6" y="39.6" className="cr3" width="13.1" height="13.1" style={{opacity: 0.4}} />
</Base>
- );
- }
-}
+);
+
+export default GridLayerIcon;
diff --git a/src/layers/src/h3-hexagon-layer/h3-hexagon-layer-icon.tsx b/src/layers/src/h3-hexagon-layer/h3-hexagon-layer-icon.tsx
index 4c8b99676..4803ac0c9 100644
--- a/src/layers/src/h3-hexagon-layer/h3-hexagon-layer-icon.tsx
+++ b/src/layers/src/h3-hexagon-layer/h3-hexagon-layer-icon.tsx
@@ -1,31 +1,20 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-class H3HexagonLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'h3-hexagon-layer-icon',
- totalColor: 4
- };
-
- render() {
- return (
- <Base {...this.props}>
+const H3HexagonLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'h3-hexagon-layer-icon',
+ totalColor = 4,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path d="M44.59,54.5H19.41L6.81,32.68,19.41,10.87H44.59L57.19,32.68Zm-23-3.83H42.38l10.38-18-10.38-18H21.62l-10.38,18Z" />
<polygon points="24.65 32.86 24.65 37.79 22.53 37.79 22.53 26.3 24.65 26.3 24.65 30.91 29.32 30.91 29.32 26.3 31.43 26.3 31.43 37.79 29.32 37.79 29.32 32.86 24.65 32.86" />
<path d="M33.79,37.05l.6-1.67a5.86,5.86,0,0,0,1.39.61,5.59,5.59,0,0,0,1.5.19A2.57,2.57,0,0,0,39,35.66a1.81,1.81,0,0,0,.61-1.46A1.29,1.29,0,0,0,38.94,33a4.55,4.55,0,0,0-2.05-.32H35.74V31h1.1A5.4,5.4,0,0,0,38,30.85a2.1,2.1,0,0,0,.77-.29,1.53,1.53,0,0,0,.51-.54,1.58,1.58,0,0,0,.15-.73,1.14,1.14,0,0,0-.51-1,2.67,2.67,0,0,0-1.5-.34,4.56,4.56,0,0,0-1.51.24,5,5,0,0,0-1.34.73l-.7-1.61a4.92,4.92,0,0,1,1.66-.83,6.91,6.91,0,0,1,2-.31,4.41,4.41,0,0,1,2.81.79,2.71,2.71,0,0,1,1,2.24,2.33,2.33,0,0,1-.54,1.62,3.45,3.45,0,0,1-1.46.93v0a3,3,0,0,1,1.67.81,2.3,2.3,0,0,1,.64,1.7A3.27,3.27,0,0,1,40.48,37a5,5,0,0,1-3.16.91A6.77,6.77,0,0,1,33.79,37.05Z" />
</Base>
- );
- }
-}
+);
export default H3HexagonLayerIcon;
diff --git a/src/layers/src/heatmap-layer/heatmap-layer-icon.tsx b/src/layers/src/heatmap-layer/heatmap-layer-icon.tsx
index 61aeb20fc..bc67c506d 100644
--- a/src/layers/src/heatmap-layer/heatmap-layer-icon.tsx
+++ b/src/layers/src/heatmap-layer/heatmap-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class HeatmapLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'heatmap-layer-icon',
- totalColor: 3
- };
-
- render() {
- return (
- <Base {...this.props}>
+const HeatmapLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'heatmap-layer-icon',
+ totalColor = 3,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path
d="M51.87,21C49.55,16.67,43.77,15.29,39,18a11.42,11.42,0,0,0-1.65,1.13c-2.73,2.14-2.12,3-6,4.89-2.27,1.07-3.42,1.08-6.88,1.4l-2.24.21a14,14,0,0,0-2.86.84c-6.64,2.73-10.11,9.86-7.76,15.94s9.63,8.79,16.27,6.07A14,14,0,0,0,31.77,46l0,0,.06-.07c.43-.4.8-.78,1.14-1.14a2.66,2.66,0,0,0,.32-.36l.17-.19c3-3.53,2-5,4.9-7.39,2.38-1.93,5.41-.95,9-3C52.19,31.15,54.19,25.43,51.87,21ZM26,44.59a8.7,8.7,0,0,1-2.26.59A7.16,7.16,0,0,1,16,40.85c-1.44-3.72.68-8.08,4.73-9.74A8.33,8.33,0,0,1,23,30.53a7.15,7.15,0,0,1,7.71,4.32C32.19,38.57,30.06,42.93,26,44.59Z"
className="cr2"
@@ -42,6 +32,6 @@ export default class HeatmapLayerIcon extends Component {
/>
<path d="M31.81,46a.09.09,0,0,1,0,0h0Z" className="cr3" />
</Base>
- );
- }
-}
+);
+
+export default HeatmapLayerIcon;
diff --git a/src/layers/src/hexagon-layer/hexagon-layer-icon.tsx b/src/layers/src/hexagon-layer/hexagon-layer-icon.tsx
index ee65328b8..b3aea71ca 100644
--- a/src/layers/src/hexagon-layer/hexagon-layer-icon.tsx
+++ b/src/layers/src/hexagon-layer/hexagon-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class HexagonLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'hexagon-layer-icon',
- totalColor: 6
- };
-
- render() {
- return (
- <Base {...this.props}>
+const HexagonLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'hexagon-layer-icon',
+ totalColor = 6,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<polygon
className="cr1"
points="23.9,10 30.9,14 30.9,22.1 23.9,26.2 16.8,22.1 16.8,14 "
@@ -52,6 +42,6 @@ export default class HexagonLayerIcon extends Component {
style={{opacity: 0.4}}
/>
</Base>
- );
- }
-}
+);
+
+export default HexagonLayerIcon;
diff --git a/src/layers/src/icon-layer/icon-layer-icon.tsx b/src/layers/src/icon-layer/icon-layer-icon.tsx
index c5b7573d7..a7b469d2d 100644
--- a/src/layers/src/icon-layer/icon-layer-icon.tsx
+++ b/src/layers/src/icon-layer/icon-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class IconLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'icon-layer-icon',
- totalColor: 3
- };
-
- render() {
- return (
- <Base {...this.props}>
+const IconLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'icon-layer-icon',
+ totalColor = 3,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path
className="cr1"
d="M42.27,33.59l-4.34,4.34-4.34-4.34a13.25,13.25,0,0,1-8.9-12.52h0A13.24,13.24,0,0,1,37.93,7.83h0A13.24,13.24,0,0,1,51.17,21.07h0A13.25,13.25,0,0,1,42.27,33.59ZM37.93,28.3a7.22,7.22,0,1,0-7.22-7.22A7.22,7.22,0,0,0,37.93,28.3Z"
@@ -34,6 +24,6 @@ export default class IconLayerIcon extends Component {
d="M48.85,55.52l-2.2,2.2-2.2-2.2a6.73,6.73,0,0,1-4.52-6.36h0a6.72,6.72,0,0,1,6.72-6.72h0a6.72,6.72,0,0,1,6.72,6.72h0A6.73,6.73,0,0,1,48.85,55.52Zm-2.2-2.69A3.67,3.67,0,1,0,43,49.17,3.67,3.67,0,0,0,46.65,52.83Z"
/>
</Base>
- );
- }
-}
+);
+
+export default IconLayerIcon;
diff --git a/src/layers/src/line-layer/line-layer-icon.tsx b/src/layers/src/line-layer/line-layer-icon.tsx
index dd3ed0dda..50d786423 100644
--- a/src/layers/src/line-layer/line-layer-icon.tsx
+++ b/src/layers/src/line-layer/line-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class LineLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'line-layer-icon',
- totalColor: 5
- };
-
- render() {
- return (
- <Base {...this.props}>
+const LineLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'line-layer-icon',
+ totalColor = 5,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<path
d="M57.8,58.3c-0.4,0-0.8-0.2-1.1-0.5L33.1,32.1c-0.6-0.6-0.5-1.6,0.1-2.1c0.6-0.6,1.6-0.5,2.1,0.1l23.7,25.8
c0.6,0.6,0.5,1.6-0.1,2.1C58.5,58.2,58.2,58.3,57.8,58.3z"
@@ -47,6 +37,6 @@ export default class LineLayerIcon extends Component {
className="cr5"
/>
</Base>
- );
- }
-}
+);
+
+export default LineLayerIcon;
diff --git a/src/layers/src/point-layer/point-layer-icon.tsx b/src/layers/src/point-layer/point-layer-icon.tsx
index ea7866bf3..62880c842 100644
--- a/src/layers/src/point-layer/point-layer-icon.tsx
+++ b/src/layers/src/point-layer/point-layer-icon.tsx
@@ -1,25 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-class PointLayerIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'point-layer-icon',
- totalColor: 6
- };
-
- render() {
- return (
- <Base {...this.props}>
+const PointLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'point-layer-icon',
+ totalColor = 6,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<circle cx="29.4" cy="31.6" r="8.4" className="cr1" />
<circle cx="48.5" cy="15.7" r="6.5" className="cr2" />
<circle cx="11" cy="44.2" r="3" className="cr3" />
@@ -27,8 +18,6 @@ class PointLayerIcon extends Component {
<circle cx="34" cy="54.2" r="3" className="cr5" />
<circle cx="14" cy="16.2" r="4" className="cr6" />
</Base>
- );
- }
-}
+);
export default PointLayerIcon;
diff --git a/src/layers/src/raster-tile/raster-tile-icon.tsx b/src/layers/src/raster-tile/raster-tile-icon.tsx
index 709779f18..901295d39 100644
--- a/src/layers/src/raster-tile/raster-tile-icon.tsx
+++ b/src/layers/src/raster-tile/raster-tile-icon.tsx
@@ -1,48 +1,36 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import PropTypes from 'prop-types';
-import React, {Component} from 'react';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-import {Base} from '../base';
-
-class RasterTileIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string.isRequired)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'raster-tile-layer-icon',
- totalColor: 2,
- viewBox: '6 2 50 50'
- };
-
- render(): React.ReactNode {
- return (
- <Base {...this.props}>
- <g>
- <path
- d="M38.244 36.0125C39.0513 35.2052 39.0513 33.8928 38.244 33.0855C37.6319 32.4735 36.6666 32.3479 35.9007 32.6936L33.8528 30.6463L37.2683 27.2302C37.398 27.1004 37.4705 26.9252 37.4705 26.7423C37.4705 26.5595 37.398 26.3835 37.2683 26.2545L31.9001 20.887L32.8764 19.9113L34.3399 21.3755C34.4745 21.5101 34.6511 21.5777 34.8278 21.5777C35.0044 21.5777 35.181 21.5101 35.3156 21.3755L42.1459 14.5452C42.4157 14.2754 42.4157 13.8393 42.1459 13.5695L38.2433 9.66621C37.9735 9.39642 37.5374 9.39642 37.2676 9.66621L30.4366 16.4965C30.3069 16.6262 30.2344 16.8015 30.2344 16.9843C30.2344 17.1672 30.3069 17.3431 30.4366 17.4722L31.9001 18.9364L30.9244 19.912L28.4853 17.4729C28.0513 17.0389 27.4392 16.8091 26.7161 16.8091C25.2078 16.8091 23.2682 17.811 21.655 19.4242C20.5379 20.5413 19.7016 21.8199 19.3 23.0253C18.8439 24.3922 18.9874 25.539 19.703 26.2545L22.1428 28.6943L21.1671 29.6707L19.703 28.2065C19.5732 28.0768 19.398 28.0043 19.2151 28.0043C19.0323 28.0043 18.8563 28.0768 18.7273 28.2065L11.897 35.0368C11.7673 35.1658 11.6948 35.3411 11.6948 35.5246C11.6948 35.7082 11.7673 35.8834 11.897 36.0125L15.8003 39.9151C15.9349 40.0497 16.1115 40.1173 16.2882 40.1173C16.4648 40.1173 16.6414 40.0497 16.776 39.9151L23.6063 33.0855C23.736 32.9558 23.8085 32.7812 23.8085 32.5977C23.8085 32.4141 23.736 32.2389 23.6063 32.1098L22.1421 30.6463L23.1185 29.67L28.4853 35.0368C28.615 35.1665 28.7903 35.239 28.9731 35.239C29.156 35.239 29.3319 35.1665 29.4609 35.0368L32.8764 31.622L34.9182 33.663C34.5538 34.4317 34.6808 35.377 35.3156 36.0125C35.7061 36.403 36.2264 36.619 36.7798 36.619C37.3325 36.619 37.8527 36.403 38.244 36.0125Z"
- fill="currentColor"
- />
- <path
- d="M36.6146 39.3087C37.9049 39.3087 39.1173 38.8063 40.0281 37.8955C40.9402 36.984 41.4426 35.771 41.4419 34.48C41.4419 34.0985 41.1328 33.79 40.7519 33.79C40.3703 33.79 40.0619 34.0992 40.0619 34.48C40.0619 35.4026 39.7031 36.2692 39.0524 36.9199C38.4024 37.5699 37.5365 37.9287 36.6146 37.9287C36.6133 37.9287 36.6119 37.9287 36.6119 37.9287C36.231 37.9287 35.9219 38.2371 35.9219 38.618C35.9219 38.9995 36.2303 39.3087 36.6112 39.3087C36.6126 39.3087 36.6133 39.3087 36.6146 39.3087Z"
- fill="currentColor"
- />
- <path
- d="M36.6119 40.69C36.2303 40.69 35.9219 40.9985 35.9219 41.38C35.9219 41.7616 36.2303 42.07 36.6119 42.07C40.7974 42.07 44.2026 38.6649 44.2026 34.48C44.2026 34.0985 43.8941 33.79 43.5126 33.79C43.131 33.79 42.8226 34.0985 42.8226 34.48C42.8226 37.9045 40.0363 40.69 36.6119 40.69Z"
- fill="currentColor"
- />
- <path
- d="M46.2719 33.79C45.8903 33.79 45.5819 34.0985 45.5819 34.48C45.5819 39.426 41.5578 43.45 36.6119 43.45C36.2303 43.45 35.9219 43.7585 35.9219 44.14C35.9219 44.5216 36.2303 44.83 36.6119 44.83C42.3189 44.83 46.9619 40.187 46.9619 34.48C46.9619 34.0985 46.6534 33.79 46.2719 33.79Z"
- fill="currentColor"
- />
- </g>
- </Base>
- );
- }
-}
+const RasterTileIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'raster-tile-layer-icon',
+ totalColor = 2,
+ viewBox = '6 2 50 50',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} viewBox={viewBox} {...props}>
+ <g>
+ <path
+ d="M38.244 36.0125C39.0513 35.2052 39.0513 33.8928 38.244 33.0855C37.6319 32.4735 36.6666 32.3479 35.9007 32.6936L33.8528 30.6463L37.2683 27.2302C37.398 27.1004 37.4705 26.9252 37.4705 26.7423C37.4705 26.5595 37.398 26.3835 37.2683 26.2545L31.9001 20.887L32.8764 19.9113L34.3399 21.3755C34.4745 21.5101 34.6511 21.5777 34.8278 21.5777C35.0044 21.5777 35.181 21.5101 35.3156 21.3755L42.1459 14.5452C42.4157 14.2754 42.4157 13.8393 42.1459 13.5695L38.2433 9.66621C37.9735 9.39642 37.5374 9.39642 37.2676 9.66621L30.4366 16.4965C30.3069 16.6262 30.2344 16.8015 30.2344 16.9843C30.2344 17.1672 30.3069 17.3431 30.4366 17.4722L31.9001 18.9364L30.9244 19.912L28.4853 17.4729C28.0513 17.0389 27.4392 16.8091 26.7161 16.8091C25.2078 16.8091 23.2682 17.811 21.655 19.4242C20.5379 20.5413 19.7016 21.8199 19.3 23.0253C18.8439 24.3922 18.9874 25.539 19.703 26.2545L22.1428 28.6943L21.1671 29.6707L19.703 28.2065C19.5732 28.0768 19.398 28.0043 19.2151 28.0043C19.0323 28.0043 18.8563 28.0768 18.7273 28.2065L11.897 35.0368C11.7673 35.1658 11.6948 35.3411 11.6948 35.5246C11.6948 35.7082 11.7673 35.8834 11.897 36.0125L15.8003 39.9151C15.9349 40.0497 16.1115 40.1173 16.2882 40.1173C16.4648 40.1173 16.6414 40.0497 16.776 39.9151L23.6063 33.0855C23.736 32.9558 23.8085 32.7812 23.8085 32.5977C23.8085 32.4141 23.736 32.2389 23.6063 32.1098L22.1421 30.6463L23.1185 29.67L28.4853 35.0368C28.615 35.1665 28.7903 35.239 28.9731 35.239C29.156 35.239 29.3319 35.1665 29.4609 35.0368L32.8764 31.622L34.9182 33.663C34.5538 34.4317 34.6808 35.377 35.3156 36.0125C35.7061 36.403 36.2264 36.619 36.7798 36.619C37.3325 36.619 37.8527 36.403 38.244 36.0125Z"
+ fill="currentColor"
+ />
+ <path
+ d="M36.6146 39.3087C37.9049 39.3087 39.1173 38.8063 40.0281 37.8955C40.9402 36.984 41.4426 35.771 41.4419 34.48C41.4419 34.0985 41.1328 33.79 40.7519 33.79C40.3703 33.79 40.0619 34.0992 40.0619 34.48C40.0619 35.4026 39.7031 36.2692 39.0524 36.9199C38.4024 37.5699 37.5365 37.9287 36.6146 37.9287C36.6133 37.9287 36.6119 37.9287 36.6119 37.9287C36.231 37.9287 35.9219 38.2371 35.9219 38.618C35.9219 38.9995 36.2303 39.3087 36.6112 39.3087C36.6126 39.3087 36.6133 39.3087 36.6146 39.3087Z"
+ fill="currentColor"
+ />
+ <path
+ d="M36.6119 40.69C36.2303 40.69 35.9219 40.9985 35.9219 41.38C35.9219 41.7616 36.2303 42.07 36.6119 42.07C40.7974 42.07 44.2026 38.6649 44.2026 34.48C44.2026 34.0985 43.8941 33.79 43.5126 33.79C43.131 33.79 42.8226 34.0985 42.8226 34.48C42.8226 37.9045 40.0363 40.69 36.6119 40.69Z"
+ fill="currentColor"
+ />
+ <path
+ d="M46.2719 33.79C45.8903 33.79 45.5819 34.0985 45.5819 34.48C45.5819 39.426 41.5578 43.45 36.6119 43.45C36.2303 43.45 35.9219 43.7585 35.9219 44.14C35.9219 44.5216 36.2303 44.83 36.6119 44.83C42.3189 44.83 46.9619 40.187 46.9619 34.48C46.9619 34.0985 46.6534 33.79 46.2719 33.79Z"
+ fill="currentColor"
+ />
+ </g>
+ </Base>
+);
export default RasterTileIcon;
diff --git a/src/layers/src/s2-geometry-layer/s2-layer-icon.tsx b/src/layers/src/s2-geometry-layer/s2-layer-icon.tsx
index a880b97b5..184bc9132 100644
--- a/src/layers/src/s2-geometry-layer/s2-layer-icon.tsx
+++ b/src/layers/src/s2-geometry-layer/s2-layer-icon.tsx
@@ -1,30 +1,19 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-class S2LayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
- static defaultProps = {
- height: '18px',
- predefinedClassName: 's2-layer-icon'
- };
-
- render() {
- return (
- <Base {...this.props}>
+const S2LayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '18px',
+ predefinedClassName = 's2-layer-icon',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} {...props}>
<path d="M14.76,58,15,20.54,50.06,6.75V44Zm4-34.86L18.6,52.38l27.66-11V12.33Z" />
<path d="M27.21,38.58a7.38,7.38,0,0,1-3.62-.9l.3-2a6.49,6.49,0,0,0,3.3.9c1.49,0,2.18-.59,2.18-1.63,0-2.26-5.71-1.28-5.71-5.3,0-2,1.26-3.54,4.16-3.54a8.38,8.38,0,0,1,3.28.64l-.29,1.9a8.41,8.41,0,0,0-2.88-.54c-1.63,0-2.14.66-2.14,1.42,0,2.19,5.71,1.18,5.71,5.27C31.5,37.16,29.93,38.58,27.21,38.58Z" />
<path d="M36.17,36.36v0h5.06l0,2H33.32V36.9c3-2.88,5.67-5.09,5.67-7,0-1-.64-1.67-2.19-1.67a5,5,0,0,0-3,1.1l-.53-1.79a6.31,6.31,0,0,1,3.91-1.28c2.66,0,4,1.34,4,3.41C41.21,31.94,39.13,33.89,36.17,36.36Z" />
</Base>
- );
- }
-}
+);
export default S2LayerIcon;
diff --git a/src/layers/src/scenegraph-layer/scenegraph-layer-icon.tsx b/src/layers/src/scenegraph-layer/scenegraph-layer-icon.tsx
index 2592d2811..a08f1d3ce 100644
--- a/src/layers/src/scenegraph-layer/scenegraph-layer-icon.tsx
+++ b/src/layers/src/scenegraph-layer/scenegraph-layer-icon.tsx
@@ -1,26 +1,16 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class ScenegraphLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'scenegraph-layer-icon',
- totalColor: 3
- };
-
- render() {
- return (
- <Base {...this.props}>
+const ScenegraphLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'scenegraph-layer-icon',
+ totalColor = 3,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
<g transform="translate(-20, -99)" id="layer1">
<g transform="matrix(0.26458333,0,0,0.26458333,-191.59545,42.388813)" id="g3042">
<ellipse
@@ -122,6 +112,6 @@ export default class ScenegraphLayerIcon extends Component {
</g>
</g>
</Base>
- );
- }
-}
+);
+
+export default ScenegraphLayerIcon;
diff --git a/src/layers/src/table.tsx b/src/layers/src/table.tsx
index de6c7c7d8..7e34c741f 100644
--- a/src/layers/src/table.tsx
+++ b/src/layers/src/table.tsx
@@ -1,30 +1,30 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
+import React from 'react';
import {Base, BaseProps} from './base';
-export default class Table extends Component<Partial<BaseProps>> {
- static defaultProps = {
- height: '16px',
- viewBox: '0 0 24 24',
- predefinedClassName: 'data-ex-icons-table'
- };
+const Table: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ viewBox = '0 0 24 24',
+ predefinedClassName = 'data-ex-icons-table',
+ ...props
+}) => (
+ <Base
+ height={height}
+ viewBox={viewBox}
+ predefinedClassName={predefinedClassName}
+ {...props}
+ style={{fill: 'none', stroke: 'currentcolor'}}
+ strokeWidth="2"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ >
+ <path d="M12 3v18" />
+ <rect width="18" height="18" x="3" y="3" rx="2" />
+ <path d="M3 9h18" />
+ <path d="M3 15h18" />
+ </Base>
+);
- render() {
- return (
- <Base
- {...this.props}
- style={{fill: 'none', stroke: 'currentcolor'}}
- strokeWidth="2"
- strokeLinecap="round"
- strokeLinejoin="round"
- >
- <path d="M12 3v18" />
- <rect width="18" height="18" x="3" y="3" rx="2" />
- <path d="M3 9h18" />
- <path d="M3 15h18" />
- </Base>
- );
- }
-}
+export default Table;
diff --git a/src/layers/src/trip-layer/trip-layer-icon.tsx b/src/layers/src/trip-layer/trip-layer-icon.tsx
index abe4d3644..cb1e5fe9b 100644
--- a/src/layers/src/trip-layer/trip-layer-icon.tsx
+++ b/src/layers/src/trip-layer/trip-layer-icon.tsx
@@ -1,26 +1,15 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import React, {Component} from 'react';
-import PropTypes from 'prop-types';
-import {Base} from '../base';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-export default class TripLayerIcon extends Component {
- static propTypes = {
- /** Set the height of the icon, ex. '16px' */
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- size: 'tiny',
- height: '16px',
- predefinedClassName: 'trip-layer-icon'
- };
-
- render() {
- return (
- <Base {...this.props}>
+const TripLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'trip-layer-icon',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} {...props}>
<g clipPath="url(#clip0)" className="cr1">
<path d="M53.025 4.85005C50.25 2.07505 45.75 2.07505 42.975 4.85005C40.2 7.62505 40.2 12.2 42.975 14.975L48 20L53.025 14.9C55.8 12.2 55.8 7.62505 53.025 4.85005ZM48 11.375C47.175 11.375 46.5 10.7 46.5 9.87505C46.5 9.05005 47.175 8.37505 48 8.37505C48.825 8.37505 49.5 9.05005 49.5 9.87505C49.5 10.7 48.825 11.375 48 11.375Z" />
</g>
@@ -40,6 +29,6 @@ export default class TripLayerIcon extends Component {
</clipPath>
</defs>
</Base>
- );
- }
-}
+);
+
+export default TripLayerIcon;
diff --git a/src/layers/src/vector-tile/vector-tile-icon.tsx b/src/layers/src/vector-tile/vector-tile-icon.tsx
index ce0344545..22f163ca3 100644
--- a/src/layers/src/vector-tile/vector-tile-icon.tsx
+++ b/src/layers/src/vector-tile/vector-tile-icon.tsx
@@ -1,78 +1,64 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import PropTypes from 'prop-types';
-import React, {Component} from 'react';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-import {Base} from '../base';
-
-class VectorTileIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string.isRequired)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'vector-tile-layer-icon',
- totalColor: 2
- };
-
- render(): React.ReactNode {
- return (
- <Base {...this.props}>
- <g id="vector-tile-layer">
- <polygon
- id="Path"
- points="12.1949893 42.9771532 3 37.4596134 12.2699446 31.9771532 21 37.45407"
- style={{opacity: 0.6}}
- />
- <polygon
- id="Path-Copy-3"
- points="22.2609912 37 13.0660019 31.4824602 22.3359466 26 31.0660019 31.4769168"
- style={{opacity: 1}}
- />
- <polygon
- id="Path-Copy-6"
- points="32.1949893 21 23 15.4824602 32.2699446 10 41 15.4769168"
- style={{
- opacity: 1
- }}
- />
- <polygon
- id="Path-Copy"
- points="22.2609912 49 13.0660019 43.4824602 22.3359466 38 31.0660019 43.4769168"
- style={{opacity: 1}}
- />
- <polygon
- id="Path-Copy-4"
- points="32.3269931 43.0228468 23.1320038 37.505307 32.4019485 32.0228468 41.1320038 37.4997636"
- style={{opacity: 0.6}}
- />
- <polygon
- id="Path-Copy-7"
- points="42.3269931 37.0228468 33.1320038 31.505307 42.4019485 26.0228468 51.1320038 31.4997636"
- style={{opacity: 1}}
- />
- <polygon
- id="Path-Copy-2"
- points="32.2609912 55 23.0660019 49.4824602 32.3359466 44 41.0660019 49.4769168"
- style={{opacity: 0.6}}
- />
- <polygon
- id="Path-Copy-5"
- points="42.3269931 49.0228468 33.1320038 43.505307 42.4019485 38.0228468 51.1320038 43.4997636"
- style={{opacity: 1}}
- />
- <polygon
- id="Path-Copy-8"
- points="53.3269931 43.0228468 44.1320038 37.505307 53.4019485 32.0228468 62.1320038 37.4997636"
- style={{opacity: 0.4}}
- />
- </g>
- </Base>
- );
- }
-}
+const VectorTileIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'vector-tile-layer-icon',
+ totalColor = 2,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
+ <g id="vector-tile-layer">
+ <polygon
+ id="Path"
+ points="12.1949893 42.9771532 3 37.4596134 12.2699446 31.9771532 21 37.45407"
+ style={{opacity: 0.6}}
+ />
+ <polygon
+ id="Path-Copy-3"
+ points="22.2609912 37 13.0660019 31.4824602 22.3359466 26 31.0660019 31.4769168"
+ style={{opacity: 1}}
+ />
+ <polygon
+ id="Path-Copy-6"
+ points="32.1949893 21 23 15.4824602 32.2699446 10 41 15.4769168"
+ style={{opacity: 1}}
+ />
+ <polygon
+ id="Path-Copy"
+ points="22.2609912 49 13.0660019 43.4824602 22.3359466 38 31.0660019 43.4769168"
+ style={{opacity: 1}}
+ />
+ <polygon
+ id="Path-Copy-4"
+ points="32.3269931 43.0228468 23.1320038 37.505307 32.4019485 32.0228468 41.1320038 37.4997636"
+ style={{opacity: 0.6}}
+ />
+ <polygon
+ id="Path-Copy-7"
+ points="42.3269931 37.0228468 33.1320038 31.505307 42.4019485 26.0228468 51.1320038 31.4997636"
+ style={{opacity: 1}}
+ />
+ <polygon
+ id="Path-Copy-2"
+ points="32.2609912 55 23.0660019 49.4824602 32.3359466 44 41.0660019 49.4769168"
+ style={{opacity: 0.6}}
+ />
+ <polygon
+ id="Path-Copy-5"
+ points="42.3269931 49.0228468 33.1320038 43.505307 42.4019485 38.0228468 51.1320038 43.4997636"
+ style={{opacity: 1}}
+ />
+ <polygon
+ id="Path-Copy-8"
+ points="53.3269931 43.0228468 44.1320038 37.505307 53.4019485 32.0228468 62.1320038 37.4997636"
+ style={{opacity: 0.4}}
+ />
+ </g>
+ </Base>
+);
export default VectorTileIcon;
diff --git a/src/layers/src/wms-layer/wms-layer-icon.tsx b/src/layers/src/wms-layer/wms-layer-icon.tsx
index 3662d6e42..df15f0289 100644
--- a/src/layers/src/wms-layer/wms-layer-icon.tsx
+++ b/src/layers/src/wms-layer/wms-layer-icon.tsx
@@ -1,59 +1,47 @@
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
-import PropTypes from 'prop-types';
-import React, {Component} from 'react';
+import React from 'react';
+import {Base, BaseProps} from '../base';
-import {Base} from '../base';
-
-class WMSLayerIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string.isRequired)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'wms-layer-icon',
- totalColor: 2,
- viewBox: '0 0 30 30'
- };
-
- render(): JSX.Element {
- return (
- <Base {...this.props}>
- <g clipPath="url(#clip0_13806_131258)">
- <path
- d="M14.7595 12.2358L1 19.9828L15.2405 28L29 20.2536L14.7595 12.2358Z"
- fill="currentColor"
- />
- <path
- d="M14.7595 7.66919L1 15.4156L15.2405 23.4334L29 15.687L14.7595 7.66919Z"
- fill="#9DA0B9"
- />
- <path d="M14.7595 2L1 9.74639L15.2405 17.7636L29 10.0172L14.7595 2Z" fill="#BFC0D1" />
- <path d="M25.9696 10.8737H4.02124V19.267H25.9696V10.8737Z" fill="currentColor" />
- <path
- d="M5.51221 12.2358H6.77682L7.643 15.9522L8.58367 12.2358H9.64733L10.629 15.9725L11.5235 12.2358H12.6784L11.3341 17.6116H10.0637L9.0693 13.8953L8.05934 17.6116H6.85362L5.51221 12.2358Z"
- fill="white"
- />
- <path
- d="M13.4314 12.2358H15.0812L16.3689 15.5817L17.6393 12.2358H19.2561V17.6116H18.0146V13.8389L16.4884 17.6116H16.0796L14.5453 13.8389V17.6116H13.4314V12.2358Z"
- fill="white"
- />
- <path
- d="M20.1084 15.9274H21.3037C21.3574 16.4088 21.5659 16.8069 22.383 16.8069C22.9304 16.8069 23.293 16.5141 23.293 16.0929C23.293 15.6717 23.0621 15.5141 22.2536 15.3936C20.8429 15.2134 20.2643 14.7995 20.2643 13.7606C20.2643 12.8433 21.0508 12.1592 22.2692 12.1592C23.5107 12.1592 24.2354 12.7003 24.3353 13.7679H23.1851C23.1077 13.2792 22.8149 13.0539 22.2675 13.0539C21.7201 13.0539 21.4423 13.3017 21.4423 13.6626C21.4423 14.0461 21.6196 14.2257 22.4679 14.3468C23.8018 14.5123 24.4889 14.8659 24.4889 15.9797C24.4889 16.937 23.6874 17.6938 22.3841 17.6938C20.8718 17.6943 20.1777 17.0029 20.1084 15.9274Z"
- fill="white"
- />
- </g>
- <defs>
- <clipPath id="clip0_13806_131258">
- <rect width="28" height="26" fill="white" transform="translate(1 2)" />
- </clipPath>
- </defs>
- </Base>
- );
- }
-}
+const WMSLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'wms-layer-icon',
+ totalColor = 2,
+ viewBox = '0 0 30 30',
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} viewBox={viewBox} {...props}>
+ <g clipPath="url(#clip0_13806_131258)">
+ <path
+ d="M14.7595 12.2358L1 19.9828L15.2405 28L29 20.2536L14.7595 12.2358Z"
+ fill="currentColor"
+ />
+ <path
+ d="M14.7595 7.66919L1 15.4156L15.2405 23.4334L29 15.687L14.7595 7.66919Z"
+ fill="#9DA0B9"
+ />
+ <path d="M14.7595 2L1 9.74639L15.2405 17.7636L29 10.0172L14.7595 2Z" fill="#BFC0D1" />
+ <path d="M25.9696 10.8737H4.02124V19.267H25.9696V10.8737Z" fill="currentColor" />
+ <path
+ d="M5.51221 12.2358H6.77682L7.643 15.9522L8.58367 12.2358H9.64733L10.629 15.9725L11.5235 12.2358H12.6784L11.3341 17.6116H10.0637L9.0693 13.8953L8.05934 17.6116H6.85362L5.51221 12.2358Z"
+ fill="white"
+ />
+ <path
+ d="M13.4314 12.2358H15.0812L16.3689 15.5817L17.6393 12.2358H19.2561V17.6116H18.0146V13.8389L16.4884 17.6116H16.0796L14.5453 13.8389V17.6116H13.4314V12.2358Z"
+ fill="white"
+ />
+ <path
+ d="M20.1084 15.9274H21.3037C21.3574 16.4088 21.5659 16.8069 22.383 16.8069C22.9304 16.8069 23.293 16.5141 23.293 16.0929C23.293 15.6717 23.0621 15.5141 22.2536 15.3936C20.8429 15.2134 20.2643 14.7995 20.2643 13.7606C20.2643 12.8433 21.0508 12.1592 22.2692 12.1592C23.5107 12.1592 24.2354 12.7003 24.3353 13.7679H23.1851C23.1077 13.2792 22.8149 13.0539 22.2675 13.0539C21.7201 13.0539 21.4423 13.3017 21.4423 13.6626C21.4423 14.0461 21.6196 14.2257 22.4679 14.3468C23.8018 14.5123 24.4889 14.8659 24.4889 15.9797C24.4889 16.937 23.6874 17.6938 22.3841 17.6938C20.8718 17.6943 20.1777 17.0029 20.1084 15.9274Z"
+ fill="white"
+ />
+ </g>
+ <defs>
+ <clipPath id="clip0_13806_131258">
+ <rect width="28" height="26" fill="white" transform="translate(1 2)" />
+ </clipPath>
+ </defs>
+ </Base>
+);
export default WMSLayerIcon;