Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(icon): icon config type #1219

Merged
merged 1 commit into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
"tinycolor2": "^1.4.2",
"tslib": "~2.3.1",
"use-resize-observer": "^9.0.2",
Expand Down
5 changes: 2 additions & 3 deletions src/config-provider/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CalendarController } from '../calendar';
import { ButtonProps } from '../button';
import { FormErrorMessage } from '../form';
import { TNode, TElement } from '../common';
import { GlobalIconConfig } from 'tdesign-icons-react';

export interface GlobalConfigProvider {
/**
Expand Down Expand Up @@ -805,6 +806,4 @@ export interface UploadTriggerUploadText {
delete?: string;
}

export interface IconConfig {
[name: string]: any;
}
export type IconConfig = GlobalIconConfig;
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