forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Collapse.tsx
45 lines (39 loc) · 1.18 KB
/
Collapse.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
import animation from '../_util/openAnimation';
export interface CollapseProps {
activeKey?: Array<string> | string;
defaultActiveKey?: Array<string>;
/** 手风琴效果 */
accordion?: boolean;
onChange?: (key: string) => void;
style?: React.CSSProperties;
className?: string;
bordered?: boolean;
prefixCls?: string;
}
export interface CollapsePanelProps {
key: string;
header: React.ReactNode;
disabled?: boolean;
className?: string;
style?: React.CSSProperties;
}
export class CollapsePanel extends React.Component<CollapsePanelProps, {}> {
}
export default class Collapse extends React.Component<CollapseProps, any> {
static Panel: typeof CollapsePanel = RcCollapse.Panel;
static defaultProps = {
prefixCls: 'ant-collapse',
bordered: true,
openAnimation: { ...animation, appear() {} },
};
render() {
const { prefixCls, className = '', bordered } = this.props;
const collapseClassName = classNames({
[`${prefixCls}-borderless`]: !bordered,
}, className);
return <RcCollapse {...this.props} className={collapseClassName} />;
}
}