import React, { useContext } from 'react';
import { ConfigProvider, Descriptions } from 'antd';
import classNames from 'classnames';
import { DescriptionsItemProps } from 'antd/lib/descriptions/Item';

const AntdDescriptionsItem = Descriptions.Item;

const DescriptionsItem = (props: DescriptionsItemProps) => {
  // 为了与 antd 的生态保持兼容性，我们要求必须要使用 `.@{ant-prefix}` 变量来生成类名
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
  const prefixCls = getPrefixCls('btri-descriptions-item');
  return (
    <AntdDescriptionsItem {...props} className={classNames(`${prefixCls}`)}>
      {props.children}
    </AntdDescriptionsItem>
  );
};
export default DescriptionsItem;
