Skip to content

Commit 3b47ed7

Browse files
authored
fix(icon): remove icon and use @dtinsight/react-icons (#592)
* fix(icon): remove icon and use @dtinsight/react-icons * test(input.match): change unit test
1 parent cec74d9 commit 3b47ed7

File tree

14 files changed

+55
-366
lines changed

14 files changed

+55
-366
lines changed

src/catalogue/components/catalogue.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import React, { useState } from 'react';
2+
import {
3+
CatalogFilled,
4+
CloseOutlined,
5+
DragOutlined,
6+
EllipsisTableOutlined,
7+
SearchOutlined,
8+
} from '@dtinsight/react-icons';
29
import { Dropdown, DropdownProps, Form, Input, Tabs } from 'antd';
310
import { BlockHeader, EllipsisText } from 'dt-react-component';
411
import { IBlockHeaderProps } from 'dt-react-component/blockHeader';
512

613
import useLocale from '../../locale/useLocale';
714
import { ITreeNode } from '../useTreeData';
8-
import { CatalogIcon, CloseIcon, DragIcon, EllipsisIcon, SearchIcon } from './icon';
915
import CatalogueTree, { ICatalogueTree } from './tree';
1016

1117
interface Tab {
@@ -53,7 +59,7 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
5359
const locale = useLocale('Catalogue');
5460
const {
5561
title,
56-
addonBefore = <CatalogIcon style={{ fontSize: 20 }} />,
62+
addonBefore = <CatalogFilled style={{ fontSize: 20 }} />,
5763
tooltip = false,
5864
showSearch = false,
5965
placeholder = locale.searchPlaceholder,
@@ -126,7 +132,7 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
126132
<div className="dt-catalogue__search">
127133
<Input.Search placeholder={placeholder} onSearch={onSearch} />
128134
{isTabMode(props) && (
129-
<CloseIcon className="close" style={{}} onClick={() => setTabSearch(false)} />
135+
<CloseOutlined className="close" onClick={() => setTabSearch(false)} />
130136
)}
131137
</div>
132138
);
@@ -140,7 +146,7 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
140146
className="dt-catalogue__tabs"
141147
size="small"
142148
tabBarExtraContent={
143-
<SearchIcon className="search" onClick={() => setTabSearch(true)} />
149+
<SearchOutlined className="search" onClick={() => setTabSearch(true)} />
144150
}
145151
activeKey={activeTabKey}
146152
onChange={onTabChange}
@@ -179,10 +185,10 @@ const Catalogue = <U extends Record<string, any> = {}, T extends readOnlyTab = a
179185
triggerNode.parentElement as HTMLElement
180186
}
181187
>
182-
<EllipsisIcon onClick={(e) => e.stopPropagation()} />
188+
<EllipsisTableOutlined onClick={(e) => e.stopPropagation()} />
183189
</Dropdown>
184190
)}
185-
{draggable && <DragIcon />}
191+
{draggable && <DragOutlined />}
186192
</div>
187193
);
188194
};

src/catalogue/components/icon.tsx

Lines changed: 0 additions & 201 deletions
This file was deleted.

src/catalogue/components/tree.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useMemo } from 'react';
2+
import { DownTriangleFilled } from '@dtinsight/react-icons';
23
import { Spin, Tree, TreeProps } from 'antd';
34
import { Empty } from 'dt-react-component';
45

56
import { ITreeNode } from '../useTreeData';
67
import { loopTree } from '../utils';
7-
import { DownTriangleIcon } from './icon';
88

99
export interface ICatalogueTree<T extends Record<string, any> = {}>
1010
extends Omit<TreeProps, 'showLine' | 'switcherIcon' | 'showIcon' | 'treeData' | 'titleRender'> {
@@ -28,7 +28,7 @@ const CatalogueTree = <T extends Record<string, any> = {}>({
2828
<Spin spinning={loading}>
2929
<Tree<ITreeNode<T>>
3030
showLine={{ showLeafIcon: false }}
31-
switcherIcon={<DownTriangleIcon style={{ fontSize: 16 }} />}
31+
switcherIcon={<DownTriangleFilled style={{ fontSize: 16 }} />}
3232
showIcon
3333
treeData={renderTreeData}
3434
titleRender={titleRender}

src/catalogue/demos/basic.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect } from 'react';
2-
import { Catalogue, EllipsisText } from 'dt-react-component';
2+
import { Catalogue } from 'dt-react-component';
33
import { useTreeData } from 'dt-react-component/catalogue/useTreeData';
44

55
const DEFAULT_DATA = [
@@ -8,12 +8,7 @@ const DEFAULT_DATA = [
88
key: '0-0',
99
children: [
1010
{
11-
title: (
12-
<EllipsisText
13-
value="长长长长长长长长长长长长长长长长长长长长长长长长Title"
14-
maxWidth="100%"
15-
/>
16-
),
11+
title: '长长长长长长长长长长长长长长长长长长长长长长长长Title',
1712
key: '0-0-0',
1813
children: [
1914
{ title: '0-0-0-0', key: '0-0-0-0' },

src/catalogue/demos/config.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect } from 'react';
22
import { DeleteOutlined, EditOutlined, PlusSquareOutlined } from '@dtinsight/react-icons';
33
import { Menu } from 'antd';
4-
import { Catalogue, EllipsisText } from 'dt-react-component';
4+
import { Catalogue } from 'dt-react-component';
55
import { CatalogueProps } from 'dt-react-component/catalogue/components/catalogue';
66
import { ITreeNode, useTreeData } from 'dt-react-component/catalogue/useTreeData';
77
import { cloneDeep } from 'lodash-es';
@@ -23,12 +23,7 @@ const DEFAULT_DATA: ITreeNode<IData>[] = [
2323
key: '0-0',
2424
children: [
2525
{
26-
title: (
27-
<EllipsisText
28-
value="长长长长长长长长长长长长长长长长长长长长长长长长Title"
29-
maxWidth="100%"
30-
/>
31-
),
26+
title: '长长长长长长长长长长长长长长长长长长长长长长长长Title',
3227
key: '0-0-0',
3328
children: [
3429
{

src/catalogue/demos/simple.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect } from 'react';
2-
import { Catalogue, EllipsisText } from 'dt-react-component';
2+
import { Catalogue } from 'dt-react-component';
33
import { useTreeData } from 'dt-react-component/catalogue/useTreeData';
44

55
const DEFAULT_DATA = [
@@ -8,12 +8,7 @@ const DEFAULT_DATA = [
88
key: '0-0',
99
children: [
1010
{
11-
title: (
12-
<EllipsisText
13-
value="长长长长长长长长长长长长长长长长长长长长长长长长Title"
14-
maxWidth="100%"
15-
/>
16-
),
11+
title: '长长长长长长长长长长长长长长长长长长长长长长长长Title',
1712
key: '0-0-0',
1813
children: [
1914
{ title: '0-0-0-0', key: '0-0-0-0' },

src/catalogue/demos/tabs.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2-
import { Catalogue, EllipsisText } from 'dt-react-component';
2+
import { Catalogue } from 'dt-react-component';
33
import { useTreeData } from 'dt-react-component/catalogue/useTreeData';
44

55
enum TreeType {
@@ -13,12 +13,7 @@ const DEFAULT_DATA = (key: TreeType) => [
1313
key: '0-0',
1414
children: [
1515
{
16-
title: (
17-
<EllipsisText
18-
value="长长长长长长长长长长长长长长长长长长长长长长长长Title"
19-
maxWidth="100%"
20-
/>
21-
),
16+
title: '长长长长长长长长长长长长长长长长长长长长长长长长Title',
2217
key: '0-0-0',
2318
children: [
2419
{ title: '0-0-0-0', key: '0-0-0-0' },

src/catalogue/utils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
2+
import { FolderFilled, FolderOpenedFilled } from '@dtinsight/react-icons';
23

34
import { CatalogueProps } from './components/catalogue';
4-
import { FolderIcon, FolderOpenedIcon } from './components/icon';
55
import { ITreeNode } from './useTreeData';
66

77
export const getIcon: ITreeNode['icon'] = ({ selected, expanded }) => {
@@ -10,8 +10,8 @@ export const getIcon: ITreeNode['icon'] = ({ selected, expanded }) => {
1010
color: '#1D78FF',
1111
};
1212

13-
if (expanded || selected) return <FolderOpenedIcon style={styles} />;
14-
return <FolderIcon style={styles} />;
13+
if (expanded || selected) return <FolderOpenedFilled style={styles} />;
14+
return <FolderFilled style={styles} />;
1515
};
1616

1717
/**
File renamed without changes.

src/empty/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { ReactNode } from 'react';
22
import { Empty as AntdEmpty, EmptyProps as AntdEmptyProps } from 'antd';
33
import classNames from 'classnames';
44

5-
import { LoupeIcon, SearchIcon } from '../components/icon';
5+
import { LoupeIcon, SearchIcon } from './icon';
66
import './style.scss';
77

88
export const IMG_MAP = {

0 commit comments

Comments
 (0)