From 05f3375c0f35808bf2913fc5d6ba6baf7baacd70 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Thu, 18 Jan 2024 16:58:31 +0800 Subject: [PATCH 1/7] fix(Tag): Fix style overwritten by antd --- packages/design/src/tag/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/design/src/tag/index.tsx b/packages/design/src/tag/index.tsx index 9f42e5a9b..c98f4caed 100644 --- a/packages/design/src/tag/index.tsx +++ b/packages/design/src/tag/index.tsx @@ -46,7 +46,12 @@ const Tag = React.forwardRef<HTMLSpanElement, TagProps>( return wrapSSR( <AntTag ref={ref} prefixCls={customizePrefixCls} className={tagCls} {...restProps}> {ellipsisConfig ? ( - <Typography.Text ellipsis={ellipsisConfig}>{children}</Typography.Text> + <Typography.Text + ellipsis={ellipsisConfig} + style={{ color: 'inherit', lineHeight: 'inhert' }} + > + {children} + </Typography.Text> ) : ( children )} From dd4ebcec6dc26e61dc7926d1c004d0094de44360 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Fri, 19 Jan 2024 10:05:09 +0800 Subject: [PATCH 2/7] fix(Typography): use inherit color and lineHeight --- packages/design/src/tag/index.tsx | 7 +------ packages/design/src/typography/Paragraph.tsx | 11 +++++++++-- packages/design/src/typography/Text.tsx | 11 +++++++++-- packages/design/src/typography/Title.tsx | 11 +++++++++-- packages/design/src/typography/style/index.ts | 2 +- 5 files changed, 29 insertions(+), 13 deletions(-) diff --git a/packages/design/src/tag/index.tsx b/packages/design/src/tag/index.tsx index c98f4caed..9f42e5a9b 100644 --- a/packages/design/src/tag/index.tsx +++ b/packages/design/src/tag/index.tsx @@ -46,12 +46,7 @@ const Tag = React.forwardRef<HTMLSpanElement, TagProps>( return wrapSSR( <AntTag ref={ref} prefixCls={customizePrefixCls} className={tagCls} {...restProps}> {ellipsisConfig ? ( - <Typography.Text - ellipsis={ellipsisConfig} - style={{ color: 'inherit', lineHeight: 'inhert' }} - > - {children} - </Typography.Text> + <Typography.Text ellipsis={ellipsisConfig}>{children}</Typography.Text> ) : ( children )} diff --git a/packages/design/src/typography/Paragraph.tsx b/packages/design/src/typography/Paragraph.tsx index 8179ed252..0df43eefc 100644 --- a/packages/design/src/typography/Paragraph.tsx +++ b/packages/design/src/typography/Paragraph.tsx @@ -1,5 +1,6 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; +import classNames from 'classnames'; import type { ParagraphProps as AntParagraphProps } from 'antd/es/typography/Paragraph'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -11,13 +12,19 @@ export * from 'antd/es/typography/Paragraph'; export interface ParagraphProps extends AntParagraphProps {} const Paragraph = React.forwardRef<HTMLDivElement, ParagraphProps>( - ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); + const cls = classNames( + { + [`${prefixCls}-inhert`]: !restProps.type, + }, + className + ); return wrapSSR( - <AntParagraph ref={ref} prefixCls={customizePrefixCls} {...restProps}> + <AntParagraph ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> {children} </AntParagraph> ); diff --git a/packages/design/src/typography/Text.tsx b/packages/design/src/typography/Text.tsx index e2e26a43a..72d095f1f 100644 --- a/packages/design/src/typography/Text.tsx +++ b/packages/design/src/typography/Text.tsx @@ -1,5 +1,6 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; +import classNames from 'classnames'; import type { TextProps as AntTextProps } from 'antd/es/typography/Text'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -11,13 +12,19 @@ export * from 'antd/es/typography/Text'; export interface TextProps extends AntTextProps {} const Text = React.forwardRef<HTMLSpanElement, TextProps>( - ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); + const cls = classNames( + { + [`${prefixCls}-inhert`]: !restProps.type, + }, + className + ); return wrapSSR( - <AntText ref={ref} prefixCls={customizePrefixCls} {...restProps}> + <AntText ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> {children} </AntText> ); diff --git a/packages/design/src/typography/Title.tsx b/packages/design/src/typography/Title.tsx index f97e15257..245b4980a 100644 --- a/packages/design/src/typography/Title.tsx +++ b/packages/design/src/typography/Title.tsx @@ -1,5 +1,6 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; +import classNames from 'classnames'; import type { TitleProps as AntTitleProps } from 'antd/es/typography/Title'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -11,13 +12,19 @@ export * from 'antd/es/typography/Title'; export interface TitleProps extends AntTitleProps {} const Title = React.forwardRef<HTMLDivElement, TitleProps>( - ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); + const cls = classNames( + { + [`${prefixCls}-inhert`]: !restProps.type, + }, + className + ); return wrapSSR( - <AntTitle ref={ref} prefixCls={customizePrefixCls} {...restProps}> + <AntTitle ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> {children} </AntTitle> ); diff --git a/packages/design/src/typography/style/index.ts b/packages/design/src/typography/style/index.ts index 0c3c459bb..b1337d607 100644 --- a/packages/design/src/typography/style/index.ts +++ b/packages/design/src/typography/style/index.ts @@ -10,7 +10,7 @@ export const genTypographyStyle: GenerateStyle<TypographyToken> = ( const { componentCls } = token; return { - [`${componentCls}`]: { + [`${componentCls}${componentCls}-inhert`]: { // inherit color and lineHeight from parent instead of fixed colorText color: 'inherit', lineHeight: 'inherit', From 657d2416908d0b6746e4b81ebffc34616c1ab894 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Mon, 22 Jan 2024 15:41:41 +0800 Subject: [PATCH 3/7] fix(Typography): use inherit for lineheight --- packages/design/src/typography/style/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/design/src/typography/style/index.ts b/packages/design/src/typography/style/index.ts index b1337d607..6248a88a7 100644 --- a/packages/design/src/typography/style/index.ts +++ b/packages/design/src/typography/style/index.ts @@ -10,10 +10,12 @@ export const genTypographyStyle: GenerateStyle<TypographyToken> = ( const { componentCls } = token; return { + [`${componentCls}`]: { + lineHeight: 'inherit', + }, [`${componentCls}${componentCls}-inhert`]: { // inherit color and lineHeight from parent instead of fixed colorText color: 'inherit', - lineHeight: 'inherit', }, }; }; From d69f2f1741510ad3e52dbbb02c51fa2e2a882b6b Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Thu, 25 Jan 2024 10:07:53 +0800 Subject: [PATCH 4/7] fix(design): update snapshots --- .../__snapshots__/index.test.tsx.snap | 44 +++++++++---------- .../__snapshots__/index.test.tsx.snap | 2 +- .../__snapshots__/index.test.tsx.snap | 4 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap index 0519fb244..79b566897 100644 --- a/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap @@ -37,7 +37,7 @@ exports[`Descriptions contentProps should work for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > This is long long long long long long long long long long long Link </span> @@ -88,7 +88,7 @@ exports[`Descriptions contentProps should work for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > This is long long long long long long long long long long long Link </span> @@ -180,7 +180,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Zhou Maomao </span> @@ -198,7 +198,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -216,7 +216,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Hangzhou, Zhejiang </span> @@ -270,7 +270,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > empty </span> @@ -288,7 +288,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -380,7 +380,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Zhou Maomao </span> @@ -398,7 +398,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -416,7 +416,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Hangzhou, Zhejiang </span> @@ -470,7 +470,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > empty </span> @@ -488,7 +488,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -539,7 +539,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Zhou Maomao </span> @@ -562,7 +562,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -585,7 +585,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Hangzhou, Zhejiang </span> @@ -612,7 +612,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > empty </span> @@ -635,7 +635,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -686,7 +686,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Zhou Maomao </span> @@ -709,7 +709,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -732,7 +732,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > Hangzhou, Zhejiang </span> @@ -759,7 +759,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > empty </span> @@ -782,7 +782,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> diff --git a/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap index 590d54f02..72e2019d7 100644 --- a/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap @@ -129,7 +129,7 @@ exports[`Segmented render options with ellipsis 1`] = ` class="ant-segmented-item-label" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > longtext </span> diff --git a/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap index c5ddbaf34..c51f5e30a 100644 --- a/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap @@ -5,7 +5,7 @@ exports[`Tag custom ellipsis 1`] = ` class="ant-tag ant-tag-ellipsis" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > <div id="test" @@ -21,7 +21,7 @@ exports[`Tag default ellipsis 1`] = ` class="ant-tag ant-tag-ellipsis" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > <div id="test" From 5eddfb02135f747b2baaf5161c6c1b38d42f51d7 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Thu, 25 Jan 2024 10:54:30 +0800 Subject: [PATCH 5/7] fix(ui): update snapshots --- .../__snapshots__/index.test.tsx.snap | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap b/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap index c34406737..b33ef4ddc 100644 --- a/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap @@ -185,7 +185,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 曲丽丽 </span> @@ -208,7 +208,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -231,7 +231,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 浙江省杭州市西湖区工专路 </span> @@ -258,7 +258,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > <a> 421421 @@ -283,7 +283,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 2017-01-10 </span> @@ -306,7 +306,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 这是备注 </span> @@ -827,7 +827,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 曲丽丽 </span> @@ -850,7 +850,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 1810000000 </span> @@ -873,7 +873,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 浙江省杭州市西湖区工专路 </span> @@ -900,7 +900,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > <a> 421421 @@ -925,7 +925,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 2017-01-10 </span> @@ -948,7 +948,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" > 这是备注 </span> From 7410efd63717df8bfaa38135d13a8778c9374ff3 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Mon, 29 Jan 2024 16:02:07 +0800 Subject: [PATCH 6/7] fix(): remove classname and restore snapshot --- .../__snapshots__/index.test.tsx.snap | 44 +++++++++---------- .../__snapshots__/index.test.tsx.snap | 2 +- .../__snapshots__/index.test.tsx.snap | 4 +- packages/design/src/typography/Paragraph.tsx | 8 +--- packages/design/src/typography/Text.tsx | 8 +--- packages/design/src/typography/Title.tsx | 8 +--- packages/design/src/typography/style/index.ts | 8 ++-- .../__snapshots__/index.test.tsx.snap | 24 +++++----- 8 files changed, 45 insertions(+), 61 deletions(-) diff --git a/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap index 79b566897..0519fb244 100644 --- a/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/descriptions/__tests__/__snapshots__/index.test.tsx.snap @@ -37,7 +37,7 @@ exports[`Descriptions contentProps should work for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > This is long long long long long long long long long long long Link </span> @@ -88,7 +88,7 @@ exports[`Descriptions contentProps should work for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > This is long long long long long long long long long long long Link </span> @@ -180,7 +180,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Zhou Maomao </span> @@ -198,7 +198,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -216,7 +216,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Hangzhou, Zhejiang </span> @@ -270,7 +270,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > empty </span> @@ -288,7 +288,7 @@ exports[`Descriptions remove colon for vertical layout by default for Descriptio class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -380,7 +380,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Zhou Maomao </span> @@ -398,7 +398,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -416,7 +416,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Hangzhou, Zhejiang </span> @@ -470,7 +470,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > empty </span> @@ -488,7 +488,7 @@ exports[`Descriptions remove colon for vertical layout by default for items 1`] class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -539,7 +539,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Zhou Maomao </span> @@ -562,7 +562,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -585,7 +585,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Hangzhou, Zhejiang </span> @@ -612,7 +612,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > empty </span> @@ -635,7 +635,7 @@ exports[`Descriptions render for Descriptions.Item 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> @@ -686,7 +686,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Zhou Maomao </span> @@ -709,7 +709,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -732,7 +732,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > Hangzhou, Zhejiang </span> @@ -759,7 +759,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > empty </span> @@ -782,7 +782,7 @@ exports[`Descriptions render for items 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China </span> diff --git a/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap index 72e2019d7..590d54f02 100644 --- a/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/segmented/__tests__/__snapshots__/index.test.tsx.snap @@ -129,7 +129,7 @@ exports[`Segmented render options with ellipsis 1`] = ` class="ant-segmented-item-label" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > longtext </span> diff --git a/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap b/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap index c51f5e30a..c5ddbaf34 100644 --- a/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/design/src/tag/__tests__/__snapshots__/index.test.tsx.snap @@ -5,7 +5,7 @@ exports[`Tag custom ellipsis 1`] = ` class="ant-tag ant-tag-ellipsis" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > <div id="test" @@ -21,7 +21,7 @@ exports[`Tag default ellipsis 1`] = ` class="ant-tag ant-tag-ellipsis" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > <div id="test" diff --git a/packages/design/src/typography/Paragraph.tsx b/packages/design/src/typography/Paragraph.tsx index 0df43eefc..d01e016fa 100644 --- a/packages/design/src/typography/Paragraph.tsx +++ b/packages/design/src/typography/Paragraph.tsx @@ -16,15 +16,9 @@ const Paragraph = React.forwardRef<HTMLDivElement, ParagraphProps>( const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); - const cls = classNames( - { - [`${prefixCls}-inhert`]: !restProps.type, - }, - className - ); return wrapSSR( - <AntParagraph ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> + <AntParagraph ref={ref} prefixCls={customizePrefixCls} {...restProps}> {children} </AntParagraph> ); diff --git a/packages/design/src/typography/Text.tsx b/packages/design/src/typography/Text.tsx index 72d095f1f..90ee5bdec 100644 --- a/packages/design/src/typography/Text.tsx +++ b/packages/design/src/typography/Text.tsx @@ -16,15 +16,9 @@ const Text = React.forwardRef<HTMLSpanElement, TextProps>( const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); - const cls = classNames( - { - [`${prefixCls}-inhert`]: !restProps.type, - }, - className - ); return wrapSSR( - <AntText ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> + <AntText ref={ref} prefixCls={customizePrefixCls} {...restProps}> {children} </AntText> ); diff --git a/packages/design/src/typography/Title.tsx b/packages/design/src/typography/Title.tsx index 245b4980a..92dfb4687 100644 --- a/packages/design/src/typography/Title.tsx +++ b/packages/design/src/typography/Title.tsx @@ -16,15 +16,9 @@ const Title = React.forwardRef<HTMLDivElement, TitleProps>( const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); - const cls = classNames( - { - [`${prefixCls}-inhert`]: !restProps.type, - }, - className - ); return wrapSSR( - <AntTitle ref={ref} prefixCls={customizePrefixCls} className={cls} {...restProps}> + <AntTitle ref={ref} prefixCls={customizePrefixCls} {...restProps}> {children} </AntTitle> ); diff --git a/packages/design/src/typography/style/index.ts b/packages/design/src/typography/style/index.ts index 6248a88a7..b8ff9bc11 100644 --- a/packages/design/src/typography/style/index.ts +++ b/packages/design/src/typography/style/index.ts @@ -10,11 +10,13 @@ export const genTypographyStyle: GenerateStyle<TypographyToken> = ( const { componentCls } = token; return { - [`${componentCls}`]: { + // inherit color and lineHeight from parent instead of fixed colorText + [`span${componentCls}`]: { lineHeight: 'inherit', + color: 'inherit', }, - [`${componentCls}${componentCls}-inhert`]: { - // inherit color and lineHeight from parent instead of fixed colorText + [`div${componentCls}`]: { + lineHeight: 'inherit', color: 'inherit', }, }; diff --git a/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap b/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap index b33ef4ddc..c34406737 100644 --- a/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/ui/src/PageContainer/__tests__/__snapshots__/index.test.tsx.snap @@ -185,7 +185,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 曲丽丽 </span> @@ -208,7 +208,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -231,7 +231,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 浙江省杭州市西湖区工专路 </span> @@ -258,7 +258,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > <a> 421421 @@ -283,7 +283,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 2017-01-10 </span> @@ -306,7 +306,7 @@ exports[`PageContainer basic 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 这是备注 </span> @@ -827,7 +827,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 曲丽丽 </span> @@ -850,7 +850,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 1810000000 </span> @@ -873,7 +873,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 浙江省杭州市西湖区工专路 </span> @@ -900,7 +900,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > <a> 421421 @@ -925,7 +925,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 2017-01-10 </span> @@ -948,7 +948,7 @@ exports[`PageContainer extra and footer 1`] = ` class="ant-descriptions-item-content" > <span - class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line ant-typography-inhert" + class="ant-typography ant-typography-ellipsis ant-typography-single-line ant-typography-ellipsis-single-line" > 这是备注 </span> From 0141e8e5af8b1c30248ea3e2c7b29272159c0381 Mon Sep 17 00:00:00 2001 From: wdy <wdy01684395@oceanbase.com> Date: Mon, 29 Jan 2024 16:11:32 +0800 Subject: [PATCH 7/7] improve(typography):remove classnames --- packages/design/src/typography/Paragraph.tsx | 3 +-- packages/design/src/typography/Text.tsx | 3 +-- packages/design/src/typography/Title.tsx | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/design/src/typography/Paragraph.tsx b/packages/design/src/typography/Paragraph.tsx index d01e016fa..8179ed252 100644 --- a/packages/design/src/typography/Paragraph.tsx +++ b/packages/design/src/typography/Paragraph.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; -import classNames from 'classnames'; import type { ParagraphProps as AntParagraphProps } from 'antd/es/typography/Paragraph'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -12,7 +11,7 @@ export * from 'antd/es/typography/Paragraph'; export interface ParagraphProps extends AntParagraphProps {} const Paragraph = React.forwardRef<HTMLDivElement, ParagraphProps>( - ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); diff --git a/packages/design/src/typography/Text.tsx b/packages/design/src/typography/Text.tsx index 90ee5bdec..e2e26a43a 100644 --- a/packages/design/src/typography/Text.tsx +++ b/packages/design/src/typography/Text.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; -import classNames from 'classnames'; import type { TextProps as AntTextProps } from 'antd/es/typography/Text'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -12,7 +11,7 @@ export * from 'antd/es/typography/Text'; export interface TextProps extends AntTextProps {} const Text = React.forwardRef<HTMLSpanElement, TextProps>( - ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls); diff --git a/packages/design/src/typography/Title.tsx b/packages/design/src/typography/Title.tsx index 92dfb4687..f97e15257 100644 --- a/packages/design/src/typography/Title.tsx +++ b/packages/design/src/typography/Title.tsx @@ -1,6 +1,5 @@ import React, { useContext } from 'react'; import { Typography as AntTypography } from 'antd'; -import classNames from 'classnames'; import type { TitleProps as AntTitleProps } from 'antd/es/typography/Title'; import ConfigProvider from '../config-provider'; import useStyle from './style'; @@ -12,7 +11,7 @@ export * from 'antd/es/typography/Title'; export interface TitleProps extends AntTitleProps {} const Title = React.forwardRef<HTMLDivElement, TitleProps>( - ({ prefixCls: customizePrefixCls, children, className, ...restProps }, ref) => { + ({ prefixCls: customizePrefixCls, children, ...restProps }, ref) => { const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('typography', customizePrefixCls); const { wrapSSR } = useStyle(prefixCls);