ant-design/components/divider/index.tsx

32 lines
792 B
TypeScript
Raw Normal View History

import * as React from 'react';
import classNames from 'classnames';
2017-11-21 20:48:22 +08:00
export interface DividerProps {
prefixCls?: string;
type?: 'horizontal' | 'vertical';
className?: string;
children?: React.ReactNode;
dashed?: boolean;
2017-12-07 23:16:25 +08:00
style?: React.CSSProperties;
2017-11-21 20:48:22 +08:00
}
export default function Divider({
prefixCls = 'ant',
type = 'horizontal',
className,
children,
2017-10-26 20:59:36 +08:00
dashed,
...restProps,
2017-11-21 20:48:22 +08:00
}: DividerProps) {
2017-10-26 20:59:36 +08:00
const classString = classNames(
className, `${prefixCls}-divider`, `${prefixCls}-divider-${type}`, {
[`${prefixCls}-divider-with-text`]: children,
2017-10-26 20:59:36 +08:00
[`${prefixCls}-divider-dashed`]: !!dashed,
});
return (
<div className={classString} {...restProps}>
{children && <span className={`${prefixCls}-divider-inner-text`}>{children}</span>}
</div>
);
}