import React, { useContext } from 'react'; import AppControlItem from './common/AppControlItem'; import { Menu } from 'antd'; import { MAPBOX_THEME_LIST, AMAP_THEME_LIST } from '../../constants'; import { MapModelContext } from '../../context/MapContext'; import styles from './index.less'; import classnames from 'classnames'; import { IMapTheme } from '../../typings'; function MapTheme() { const { mapTheme, setMapTheme, mapType } = useContext(MapModelContext); return ( } dropdown={ {(mapType === 'amap' ? AMAP_THEME_LIST : MAPBOX_THEME_LIST).map( (item) => ( { setMapTheme(key as IMapTheme); }} > {item.label} ), )} } /> ); } export default MapTheme;