Skip to content

Commit

Permalink
feat: legendicon icon名称调整
Browse files Browse the repository at this point in the history
  • Loading branch information
shengzheng committed Apr 10, 2024
1 parent 52fc2f8 commit 80d3aaa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/Legend/LegendIcon/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ nav:

<API></API>

#### LegendIcons
#### IconType

```ts
type LegendIcons = string | React.ReactElement;
type IconType = string | React.ReactElement;
```
4 changes: 2 additions & 2 deletions src/components/Legend/LegendIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -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') {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Legend/LegendIcon/types.ts
Original file line number Diff line number Diff line change
@@ -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[];
}

0 comments on commit 80d3aaa

Please sign in to comment.