2017-11-17 14:38:54 +08:00
|
|
|
import * as React from 'react';
|
2017-07-07 13:36:54 +08:00
|
|
|
import classNames from 'classnames';
|
2018-12-05 19:12:18 +08:00
|
|
|
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
2017-07-07 13:36:54 +08:00
|
|
|
|
|
|
|
export interface CardGridProps {
|
|
|
|
prefixCls?: string;
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
className?: string;
|
2019-08-25 16:00:47 +08:00
|
|
|
hoverable?: boolean;
|
2017-07-07 13:36:54 +08:00
|
|
|
}
|
|
|
|
|
2019-02-19 13:37:38 +08:00
|
|
|
const Grid: React.SFC<CardGridProps> = props => (
|
2018-12-05 19:12:18 +08:00
|
|
|
<ConfigConsumer>
|
|
|
|
{({ getPrefixCls }: ConfigConsumerProps) => {
|
2019-08-25 16:00:47 +08:00
|
|
|
const { prefixCls: customizePrefixCls, className, hoverable = true, ...others } = props;
|
2018-12-05 19:12:18 +08:00
|
|
|
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
2019-08-25 16:00:47 +08:00
|
|
|
const classString = classNames(`${prefixCls}-grid`, className, {
|
|
|
|
[`${prefixCls}-grid-hoverable`]: hoverable,
|
|
|
|
});
|
2018-12-05 19:12:18 +08:00
|
|
|
return <div {...others} className={classString} />;
|
|
|
|
}}
|
|
|
|
</ConfigConsumer>
|
|
|
|
);
|
2019-02-19 13:37:38 +08:00
|
|
|
|
|
|
|
export default Grid;
|