Skip to content

Commit

Permalink
fix(list): fix error of selection component (#1460)
Browse files Browse the repository at this point in the history
Co-authored-by: maxin <maxin@growingio.com>
  • Loading branch information
nnmax and maxin committed Nov 10, 2021
1 parent cb92985 commit 3a17098
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/list/Selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ import { PREFIX } from './constants';
import { SelectionProps } from './interfance';

const Selection: React.FC<SelectionProps> = (props) => {
const { className, style, value, onChange, children } = props;
const { className, style, children } = props;
const prefixCls = `${usePrefixCls(PREFIX)}--selection`;
return (
<div className={classNames(prefixCls, className)} style={style}>
{React.cloneElement(children as React.ReactElement, {
value,
onChange,
})}
{children}
</div>
);
};
Expand Down
6 changes: 2 additions & 4 deletions src/list/SelectionItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import { PREFIX } from './constants';
import { SelectionItemProps } from './interfance';

const Selection: React.FC<SelectionItemProps> = (props) => {
const { className, style, title, children, onChange } = props;
const { className, style, title, children } = props;
const prefixCls = `${usePrefixCls(PREFIX)}--selection--item`;
return (
<div className={classNames(prefixCls, className)} style={style}>
<div className={`${prefixCls}--title`}>{title}</div>
{React.cloneElement(children as React.ReactElement, {
onChange,
})}
{children}
</div>
);
};
Expand Down

1 comment on commit 3a17098

@vercel
Copy link

@vercel vercel bot commented on 3a17098 Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.