Skip to content

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

chore: layer icons to functional components (#3417)

Igor Dykhtaad1f4a5fe3e5
diff --git a/src/layers/src/flow-layer/flow-layer-icon.tsx b/src/layers/src/flow-layer/flow-layer-icon.tsx
index 4cbaea64b..0ad887832 100644
--- a/src/layers/src/flow-layer/flow-layer-icon.tsx
+++ b/src/layers/src/flow-layer/flow-layer-icon.tsx
@@ -1,49 +1,38 @@
// 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';
-
-class FlowLayerIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
-
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'flow-layer-icon',
- totalColor: 3
- };
-
- render() {
- return (
- <Base {...this.props} viewBox="0 0 64 64">
- {/* Left point */}
- <circle cx="10" cy="42" r="4.5" className="cr1" />
- {/* Right point */}
- <circle cx="54" cy="42" r="4.5" className="cr2" />
- {/* Top point */}
- <circle cx="36" cy="10" r="4.5" className="cr3" />
-
- {/* Arrow left -> right: gentle upper arc, thick band */}
- <path d="M17,38 C26,26 42,26 49,36 L48,32 C42,23 24,23 16,34 Z" className="cr1" />
- {/* Arrowhead right */}
- <path d="M47,30 L52,38 L45,37 Z" className="cr1" />
-
- {/* Arrow right -> left: gentle lower arc, thick band */}
- <path d="M47,46 C38,58 22,58 15,48 L16,52 C22,61 40,61 48,50 Z" className="cr2" />
- {/* Arrowhead left */}
- <path d="M17,54 L12,46 L19,47 Z" className="cr2" />
-
- {/* Arrow left -> top: gentle curve */}
- <path d="M13,37 C12,24 20,15 32,11 L30,14 C20,18 15,26 15,36 Z" className="cr3" />
- {/* Arrowhead top */}
- <path d="M29,9 L35,12 L29,16 Z" className="cr3" />
- </Base>
- );
- }
-}
+import React from 'react';
+import {Base, BaseProps} from '../base';
+
+const FlowLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'flow-layer-icon',
+ totalColor = 3,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props} viewBox="0 0 64 64">
+ {/* Left point */}
+ <circle cx="10" cy="42" r="4.5" className="cr1" />
+ {/* Right point */}
+ <circle cx="54" cy="42" r="4.5" className="cr2" />
+ {/* Top point */}
+ <circle cx="36" cy="10" r="4.5" className="cr3" />
+
+ {/* Arrow left -> right: gentle upper arc, thick band */}
+ <path d="M17,38 C26,26 42,26 49,36 L48,32 C42,23 24,23 16,34 Z" className="cr1" />
+ {/* Arrowhead right */}
+ <path d="M47,30 L52,38 L45,37 Z" className="cr1" />
+
+ {/* Arrow right -> left: gentle lower arc, thick band */}
+ <path d="M47,46 C38,58 22,58 15,48 L16,52 C22,61 40,61 48,50 Z" className="cr2" />
+ {/* Arrowhead left */}
+ <path d="M17,54 L12,46 L19,47 Z" className="cr2" />
+
+ {/* Arrow left -> top: gentle curve */}
+ <path d="M13,37 C12,24 20,15 32,11 L30,14 C20,18 15,26 15,36 Z" className="cr3" />
+ {/* Arrowhead top */}
+ <path d="M29,9 L35,12 L29,16 Z" className="cr3" />
+ </Base>
+);
export default FlowLayerIcon;
diff --git a/src/layers/src/tile3d-layer/tile3d-layer-icon.tsx b/src/layers/src/tile3d-layer/tile3d-layer-icon.tsx
index 075bf3d77..0881e918d 100644
--- a/src/layers/src/tile3d-layer/tile3d-layer-icon.tsx
+++ b/src/layers/src/tile3d-layer/tile3d-layer-icon.tsx
@@ -1,33 +1,24 @@
// 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 Tile3DLayerIcon extends Component {
- static propTypes = {
- height: PropTypes.string,
- colors: PropTypes.arrayOf(PropTypes.string)
- };
+const Tile3DLayerIcon: React.FC<Partial<BaseProps>> = ({
+ height = '16px',
+ predefinedClassName = 'tile3d-layer-icon',
+ totalColor = 2,
+ ...props
+}) => (
+ <Base height={height} predefinedClassName={predefinedClassName} totalColor={totalColor} {...props}>
+ <g transform="translate(6, 6)">
+ <path d="M24 2L44 13.5V36.5L24 48L4 36.5V13.5L24 2Z" fill="currentColor" opacity="0.2" />
+ <path d="M24 2L44 13.5L24 25L4 13.5L24 2Z" fill="currentColor" opacity="0.6" />
+ <path d="M24 25V48L4 36.5V13.5L24 25Z" fill="currentColor" opacity="0.4" />
+ <path d="M24 25V48L44 36.5V13.5L24 25Z" fill="currentColor" opacity="0.8" />
+ <path d="M14 7.5L34 19V35.5L14 24V7.5Z" fill="currentColor" opacity="0.3" />
+ </g>
+ </Base>
+);
- static defaultProps = {
- height: '16px',
- predefinedClassName: 'tile3d-layer-icon',
- totalColor: 2
- };
-
- render() {
- return (
- <Base {...this.props}>
- <g transform="translate(6, 6)">
- <path d="M24 2L44 13.5V36.5L24 48L4 36.5V13.5L24 2Z" fill="currentColor" opacity="0.2" />
- <path d="M24 2L44 13.5L24 25L4 13.5L24 2Z" fill="currentColor" opacity="0.6" />
- <path d="M24 25V48L4 36.5V13.5L24 25Z" fill="currentColor" opacity="0.4" />
- <path d="M24 25V48L44 36.5V13.5L24 25Z" fill="currentColor" opacity="0.8" />
- <path d="M14 7.5L34 19V35.5L14 24V7.5Z" fill="currentColor" opacity="0.3" />
- </g>
- </Base>
- );
- }
-}
+export default Tile3DLayerIcon;