fix: classNames typing errors (#30018)

This commit is contained in:
afc163 2021-04-02 22:37:36 +08:00 committed by GitHub
parent dda9f61458
commit 13a829d20c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 13 deletions

View File

@ -261,7 +261,7 @@ class Affix extends React.Component<AffixProps, AffixState> {
const { affixStyle, placeholderStyle } = this.state;
const { prefixCls, children } = this.props;
const className = classNames({
[getPrefixCls('affix', prefixCls)]: affixStyle,
[getPrefixCls('affix', prefixCls)]: !!affixStyle,
});
let props = omit(this.props, ['prefixCls', 'offsetTop', 'offsetBottom', 'target', 'onChange']);

View File

@ -9,7 +9,7 @@ import useBreakpoint from '../grid/hooks/useBreakpoint';
import SizeContext, { AvatarSize } from './SizeContext';
export interface AvatarProps {
/** Shape of avatar, options:`circle`, `square` */
/** Shape of avatar, options: `circle`, `square` */
shape?: 'circle' | 'square';
/*
* Size of avatar, options: `large`, `small`, `default`
@ -138,9 +138,9 @@ const InternalAvatar: React.ForwardRefRenderFunction<unknown, AvatarProps> = (pr
prefixCls,
sizeCls,
{
[`${prefixCls}-${shape}`]: shape,
[`${prefixCls}-${shape}`]: !!shape,
[`${prefixCls}-image`]: hasImageElement || (src && isImgExist),
[`${prefixCls}-icon`]: icon,
[`${prefixCls}-icon`]: !!icon,
},
className,
);

View File

@ -237,7 +237,7 @@ const InternalButton: React.ForwardRefRenderFunction<unknown, ButtonProps> = (pr
[`${prefixCls}-${type}`]: type,
[`${prefixCls}-${shape}`]: shape,
[`${prefixCls}-${sizeCls}`]: sizeCls,
[`${prefixCls}-icon-only`]: !children && children !== 0 && iconType,
[`${prefixCls}-icon-only`]: !children && children !== 0 && !!iconType,
[`${prefixCls}-background-ghost`]: ghost && !isUnborderedButtonType(type),
[`${prefixCls}-loading`]: innerLoading,
[`${prefixCls}-two-chinese-chars`]: hasTwoCNChar && autoInsertSpace,

View File

@ -188,7 +188,7 @@ function FormItem<Values = any>(props: FormItemProps<Values>): React.ReactElemen
const itemClassName = {
[`${prefixCls}-item`]: true,
[`${prefixCls}-item-with-help`]: domErrorVisible || help,
[`${prefixCls}-item-with-help`]: domErrorVisible || !!help,
[`${className}`]: !!className,
// Status

View File

@ -174,7 +174,7 @@ function List<T>({
[`${prefixCls}-split`]: split,
[`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-loading`]: isLoading,
[`${prefixCls}-grid`]: grid,
[`${prefixCls}-grid`]: !!grid,
[`${prefixCls}-something-after-last-item`]: isSomethingAfterLastItem(),
[`${prefixCls}-rtl`]: direction === 'rtl',
},

View File

@ -161,8 +161,8 @@ const PageHeader: React.FC<PageHeaderProps> = props => {
breadcrumbRender?.(props, defaultBreadcrumbDom) || defaultBreadcrumbDom;
const className = classNames(prefixCls, customizeClassName, {
'has-breadcrumb': breadcrumbDom,
'has-footer': footer,
'has-breadcrumb': !!breadcrumbDom,
'has-footer': !!footer,
[`${prefixCls}-ghost`]: ghost,
[`${prefixCls}-rtl`]: direction === 'rtl',
[`${prefixCls}-compact`]: compact,

View File

@ -157,7 +157,7 @@ function injectSorter<RecordType>(
<span>{renderColumnTitle(column.title, renderProps)}</span>
<span
className={classNames(`${prefixCls}-column-sorter`, {
[`${prefixCls}-column-sorter-full`]: upNode && downNode,
[`${prefixCls}-column-sorter-full`]: !!(upNode && downNode),
})}
>
<span className={`${prefixCls}-column-sorter-inner`}>

View File

@ -43,7 +43,7 @@ const TimelineItem: React.FC<TimelineItemProps> = ({
const dotClassName = classNames({
[`${prefixCls}-item-head`]: true,
[`${prefixCls}-item-head-custom`]: dot,
[`${prefixCls}-item-head-custom`]: !!dot,
[`${prefixCls}-item-head-${color}`]: true,
});

View File

@ -320,8 +320,8 @@ export default class TransferList<
const footerDom = footer && footer(this.props);
const listCls = classNames(prefixCls, {
[`${prefixCls}-with-pagination`]: pagination,
[`${prefixCls}-with-footer`]: footerDom,
[`${prefixCls}-with-pagination`]: !!pagination,
[`${prefixCls}-with-footer`]: !!footerDom,
});
// ====================== Get filtered, checked item list ======================