ant-design/components/collapse/index.tsx
偏右 7f422c9e18 Feat collapse bordered (#3698)
* update ts types

* Add borderless style Collapse, close #3559

* update Collapse mix demo

* update demo description
2016-11-06 15:06:34 +08:00

44 lines
1.1 KiB
TypeScript

import React from 'react';
import RcCollapse from 'rc-collapse';
import classNames from 'classnames';
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;
style?: React.CSSProperties;
className?: string;
}
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,
};
render() {
const { prefixCls, className = '', bordered } = this.props;
const collapseClassName = classNames({
[`${prefixCls}-borderless`]: !bordered,
[className]: !!className,
});
return <RcCollapse {...this.props} className={collapseClassName} />;
}
}