diff --git a/src/components/Legend/LegendIcon/index.md b/src/components/Legend/LegendIcon/index.md index ae5cc7ba..e503f5a1 100644 --- a/src/components/Legend/LegendIcon/index.md +++ b/src/components/Legend/LegendIcon/index.md @@ -31,8 +31,8 @@ nav: -#### LegendIcons +#### IconType ```ts -type LegendIcons = string | React.ReactElement; +type IconType = string | React.ReactElement; ``` diff --git a/src/components/Legend/LegendIcon/index.tsx b/src/components/Legend/LegendIcon/index.tsx index e8fb5e76..f6798438 100644 --- a/src/components/Legend/LegendIcon/index.tsx +++ b/src/components/Legend/LegendIcon/index.tsx @@ -1,14 +1,14 @@ import classnames from 'classnames'; import React from 'react'; import './index.less'; -import type { LegendIconProps, LegendIcons } from './types'; +import type { IconType, LegendIconProps } from './types'; export const CLS_PREFIX = 'larkmap-legend-icon'; export const LegendIcon = (props: LegendIconProps) => { const { labels, icons, className: cls, style } = props; - const renderIcon = (icon: LegendIcons) => { + const renderIcon = (icon: IconType) => { if (React.isValidElement(icon)) { return icon; } else if (typeof icon === 'string') { diff --git a/src/components/Legend/LegendIcon/types.ts b/src/components/Legend/LegendIcon/types.ts index 885d585f..706ab6bd 100644 --- a/src/components/Legend/LegendIcon/types.ts +++ b/src/components/Legend/LegendIcon/types.ts @@ -1,10 +1,10 @@ import type { CommonProps } from '../../../types/common'; -export type LegendIcons = string | React.ReactElement; +export type IconType = string | React.ReactElement; export interface LegendIconProps extends CommonProps { /** 图例项名称 */ labels: string[]; /** 图例项图标 */ - icons: LegendIcons[]; + icons: IconType[]; }