Skip to content

Commit

Permalink
feat(icon): icon config type
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Aug 3, 2022
1 parent d63bae2 commit 5b7e322
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@
"@types/raf": "^3.4.0",
"@types/react": "^17.0.19",
"@types/react-dom": "^17.0.9",
"@types/react-is": "^17.0.3",
"@types/react-transition-group": "^4.4.2",
"@types/rimraf": "^3.0.2",
"@types/testing-library__jest-dom": "^5.14.2",
"@types/react-is": "^17.0.3",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@vitejs/plugin-react": "^1.3.2",
Expand Down Expand Up @@ -215,7 +215,7 @@
"react-popper": "~2.2.5",
"react-transition-group": "~4.4.1",
"sortablejs": "^1.15.0",
"tdesign-icons-react": "^0.1.2",
"tdesign-icons-react": "0.1.5-alpha.1",
"tinycolor2": "^1.4.2",
"tslib": "~2.3.1",
"use-resize-observer": "^9.0.2",
Expand Down
6 changes: 2 additions & 4 deletions src/config-provider/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CalendarController } from '../calendar';
import { ButtonProps } from '../button';
import { FormErrorMessage } from '../form';
import { TNode, TElement } from '../common';

import { GlobalIconType } from 'tdesign-icons-react';
export interface GlobalConfigProvider {
/**
* icon 全局配置,用来覆盖内置 tdesign-icons
Expand Down Expand Up @@ -805,6 +805,4 @@ export interface UploadTriggerUploadText {
delete?: string;
}

export interface IconConfig {
[name: string]: any;
}
export type IconConfig = GlobalIconType;
2 changes: 1 addition & 1 deletion src/hooks/useGlobalIcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import useConfig from './useConfig';
import { IconConfig } from '../config-provider/type';

// 从 globalConfig 获取 icon 配置用于覆盖组件内置 icon
export default function useGlobalIcon(tdIcon: Object) {
export default function useGlobalIcon(tdIcon: IconConfig) {
const { icon: globalIcon } = useConfig();

const resultIcon: IconConfig = {};
Expand Down

0 comments on commit 5b7e322

Please sign in to comment.