Skip to content

feat: use dtinsight/react-icons replace ant-design/icons #568

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-test-renderer": "^18.2.0",
"standard-version": "^9.5.0",
"resize-observer-polyfill": "^1.5.1",
"standard-version": "^9.5.0",
"stylelint": "^14.9.1",
"ts-jest": "^29.0.3",
"typescript": "~4.5.2"
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@dtinsight/dt-utils": "^1.3.1",
"@dtinsight/react-icons": "^1.0.0",
"@handsontable/react": "2.1.0",
"antd": "4.22.5",
"classnames": "^2.2.6",
Expand Down
24,577 changes: 15,205 additions & 9,372 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/blockHeader/demos/addonBefore.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import { PauseCircleOutlined, PieChartOutlined } from '@ant-design/icons';
import { PauseOutlined, PieChartFilled } from '@dtinsight/react-icons';
import { BlockHeader } from 'dt-react-component';

export default () => {
return (
<>
<BlockHeader title="分类标题" />
<BlockHeader title="分类标题" addonBefore={''} />
<BlockHeader title="分类标题" addonBefore={<PieChartOutlined />} />
<BlockHeader title="分类标题" addonBefore={<PauseCircleOutlined />} />
<BlockHeader title="分类标题" addonBefore={<PieChartFilled />} />
<BlockHeader title="分类标题" addonBefore={<PauseOutlined />} />
</>
);
};
2 changes: 1 addition & 1 deletion src/blockHeader/demos/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import { PieChartOutlined } from '@ant-design/icons';
import { PieChartOutlined } from '@dtinsight/react-icons';
import { Radio, Space, Switch } from 'antd';
import { BlockHeader } from 'dt-react-component';
import { SizeType } from 'dt-react-component/blockHeader';
Expand Down
4 changes: 2 additions & 2 deletions src/blockHeader/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactNode, useState } from 'react';
import { QuestionCircleOutlined, UpOutlined } from '@ant-design/icons';
import { QuestionOutlined, UpOutlined } from '@dtinsight/react-icons';
import { Tooltip } from 'antd';
import classNames from 'classnames';

Expand Down Expand Up @@ -115,7 +115,7 @@ const BlockHeader: React.FC<IBlockHeaderProps> = function (props) {
{tooltipProps?.title ? (
<div className={`title__tooltip`}>
<Tooltip {...tooltipProps}>
<QuestionCircleOutlined />
<QuestionOutlined />
</Tooltip>
</div>
) : null}
Expand Down
4 changes: 2 additions & 2 deletions src/chat/demos/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { LikeOutlined } from '@ant-design/icons';
import { ThumbsUpOutlined } from '@dtinsight/react-icons';
import { Button } from 'antd';
import { Chat, Flex } from 'dt-react-component';

Expand Down Expand Up @@ -44,7 +44,7 @@ export default function () {
codeBlock={{
convert,
}}
messageIcons={() => <LikeOutlined className="dtc__message__icon" />}
messageIcons={() => <ThumbsUpOutlined className="dtc__message__icon" />}
components={{
a: ({ children }) => (
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/chat/demos/codeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* background: '#f6f7f9'
*/
import React from 'react';
import { PlusCircleOutlined } from '@ant-design/icons';
import { PlusCircleOutlined } from '@dtinsight/react-icons';
import { Chat } from 'dt-react-component';

const children = `
Expand Down
2 changes: 1 addition & 1 deletion src/chat/pagination/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
import { LeftOutlined, RightOutlined } from '@dtinsight/react-icons';

import './index.scss';

Expand Down
2 changes: 1 addition & 1 deletion src/collapsibleActionItems/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default () => {
import React, { useState } from 'react';
import { CollapsibleActionItems } from 'dt-react-component';
import { Table, message, Popconfirm } from 'antd';
import { DownOutlined } from '@ant-design/icons';
import { DownOutlined } from '@dtinsight/react-icons';

export default () => {
const [dataSource, setDataSource] = useState([
Expand Down
4 changes: 2 additions & 2 deletions src/collapsibleActionItems/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactNode } from 'react';
import { EllipsisOutlined } from '@ant-design/icons';
import { EllipsisTableOutlined } from '@dtinsight/react-icons';
import { Button, ButtonProps, Divider, Dropdown, DropDownProps, Menu } from 'antd';
import classNames from 'classnames';

Expand Down Expand Up @@ -30,7 +30,7 @@ const CollapsibleActionItems: React.FC<ICollapsibleActionItems> = (props) => {
maxCount = 3,
className,
divider = <Divider type="vertical" />,
collapseIcon = <EllipsisOutlined />,
collapseIcon = <EllipsisTableOutlined />,
dropdownProps,
buttonProps,
style,
Expand Down
2 changes: 1 addition & 1 deletion src/drawer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { CSSProperties, useEffect, useState } from 'react';
import { CloseOutlined } from '@ant-design/icons';
import { CloseOutlined } from '@dtinsight/react-icons';
import { Alert, AlertProps, Spin, Tabs } from 'antd';
import classNames from 'classnames';
import { omit } from 'lodash-es';
Expand Down
2 changes: 1 addition & 1 deletion src/filterRules/ruleController/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
import { MinusCircleOutlined, PlusCircleOutlined } from '@dtinsight/react-icons';
import { InternalNamePath } from 'antd/lib/form/interface';
import classnames from 'classnames';

Expand Down
6 changes: 3 additions & 3 deletions src/fullscreen/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ArrowsAltOutlined, ShrinkOutlined } from '@ant-design/icons';
import { FullscreenExitOutlined, FullscreenOutlined } from '@dtinsight/react-icons';
import { cleanup, fireEvent, render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

Expand All @@ -18,13 +18,13 @@ describe('test Fullscreen', () => {
const customIcon = {
fullIcon: (
<>
<ArrowsAltOutlined />
<FullscreenOutlined />
全屏
</>
),
exitFullIcon: (
<>
<ShrinkOutlined />
<FullscreenExitOutlined />
退出全屏
</>
),
Expand Down
6 changes: 3 additions & 3 deletions src/fullscreen/demos/custom.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { ArrowsAltOutlined, ShrinkOutlined } from '@ant-design/icons';
import { FullscreenExitOutlined, FullscreenOutlined } from '@dtinsight/react-icons';
import { Fullscreen } from 'dt-react-component';

export default () => {
Expand All @@ -14,13 +14,13 @@ export default () => {
iconStyle={iconStyle}
fullIcon={
<div style={{ cursor: 'pointer' }}>
<ArrowsAltOutlined />
<FullscreenOutlined />
全屏
</div>
}
exitFullIcon={
<div style={{ cursor: 'pointer' }}>
<ShrinkOutlined />
<FullscreenExitOutlined />
退出全屏
</div>
}
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import '@dtinsight/react-icons/dist/index.css';

export { default as BlockHeader } from './blockHeader';
export { default as Catalogue } from './catalogue';
export { default as Chat } from './chat';
Expand Down
10 changes: 5 additions & 5 deletions src/statusTag/demos/icon.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react';
import { SketchOutlined } from '@ant-design/icons';
import { TargetFilled } from '@dtinsight/react-icons';
import { Space } from 'antd';
import { StatusTag } from 'dt-react-component';

export default () => {
return (
<Space direction="vertical">
<StatusTag color="green" type="outline" icon={<SketchOutlined />}>
<StatusTag color="green" type="outline" icon={<TargetFilled />}>
成功
</StatusTag>
<StatusTag color="blue" icon={<SketchOutlined />}>
<StatusTag color="blue" icon={<TargetFilled />}>
运行中
</StatusTag>
<StatusTag color="yellow" type="fill" icon={<SketchOutlined />}>
<StatusTag color="yellow" type="fill" icon={<TargetFilled />}>
运行中
</StatusTag>
<StatusTag color="#2f10fb" type="fill" icon={<SketchOutlined />}>
<StatusTag color="#2f10fb" type="fill" icon={<TargetFilled />}>
运行中
</StatusTag>
</Space>
Expand Down
8 changes: 6 additions & 2 deletions src/statusTag/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { CSSProperties, HTMLAttributes, ReactNode } from 'react';
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
import { SpinOutlined } from '@dtinsight/react-icons';
import { Spin } from 'antd';
import classNames from 'classnames';

Expand Down Expand Up @@ -107,7 +107,11 @@ const StatusTag: React.FC<IStatusTagProps> = function StatusTag(props) {
{loading ? (
<Spin
spinning
indicator={<LoadingOutlined className={`${prefixCls}__icon`} />}
indicator={
<SpinOutlined
className={`${prefixCls}__icon ${prefixCls}__icon--loading`}
/>
}
size="small"
/>
) : (
Expand Down
14 changes: 13 additions & 1 deletion src/statusTag/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $colors: (
bg: #E7FBF7,
),
"gray": (
color: #B1B4C5,
color: #B1B4C5,
bg: #F5F5F8,
),
"red": (
Expand All @@ -34,6 +34,15 @@ $colors: (
),
);

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

.#{$card_prefix} {
display: flex;
align-items: center;
Expand Down Expand Up @@ -65,6 +74,9 @@ $colors: (
height: 6px;
border-radius: 50%;
}
&--loading {
animation: spin 1s linear infinite;
}
}
&__text {
font-size: 12px;
Expand Down
4 changes: 2 additions & 2 deletions src/table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { forwardRef, useMemo } from 'react';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { QuestionOutlined } from '@dtinsight/react-icons';
import { Table as InternalTable, Tooltip } from 'antd';
import type { LabelTooltipType, WrapperTooltipProps } from 'antd/lib/form/FormItemLabel';
import type { ColumnType as PrimitiveColumnType, TableProps } from 'antd/lib/table';
Expand Down Expand Up @@ -51,7 +51,7 @@ function convertColumns(columns?: ColumnType[]): PrimitiveColumnType<any>[] {
const tooltipProps = toTooltipProps(tooltip);
let tooltipNode: React.ReactNode | null = null;
if (tooltipProps) {
const { icon = <QuestionCircleOutlined />, ...restTooltipProps } = tooltipProps;
const { icon = <QuestionOutlined />, ...restTooltipProps } = tooltipProps;
tooltipNode = (
<Tooltip {...restTooltipProps}>
{React.cloneElement(icon, {
Expand Down
Loading