2017-07-07 13:36:54 +08:00
|
|
|
import classNames from 'classnames';
|
2022-06-22 14:57:09 +08:00
|
|
|
import * as React from 'react';
|
2022-05-07 14:31:54 +08:00
|
|
|
import type { ConfigConsumerProps } from '../config-provider';
|
|
|
|
import { ConfigConsumer } from '../config-provider';
|
2017-07-07 13:36:54 +08:00
|
|
|
|
2022-01-05 19:53:58 +08:00
|
|
|
export interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
2017-07-07 13:36:54 +08:00
|
|
|
prefixCls?: string;
|
|
|
|
className?: string;
|
2019-08-25 16:00:47 +08:00
|
|
|
hoverable?: boolean;
|
2020-11-16 22:16:33 +08:00
|
|
|
style?: React.CSSProperties;
|
2017-07-07 13:36:54 +08:00
|
|
|
}
|
|
|
|
|
2020-11-16 22:16:33 +08:00
|
|
|
const Grid: React.FC<CardGridProps> = ({ prefixCls, className, hoverable = true, ...props }) => (
|
2018-12-05 19:12:18 +08:00
|
|
|
<ConfigConsumer>
|
|
|
|
{({ getPrefixCls }: ConfigConsumerProps) => {
|
2020-11-16 22:16:33 +08:00
|
|
|
const prefix = getPrefixCls('card', prefixCls);
|
2020-12-09 17:12:32 +08:00
|
|
|
const classString = classNames(`${prefix}-grid`, className, {
|
|
|
|
[`${prefix}-grid-hoverable`]: hoverable,
|
|
|
|
});
|
2020-11-16 22:16:33 +08:00
|
|
|
|
|
|
|
return <div {...props} className={classString} />;
|
2018-12-05 19:12:18 +08:00
|
|
|
}}
|
|
|
|
</ConfigConsumer>
|
|
|
|
);
|
2019-02-19 13:37:38 +08:00
|
|
|
|
|
|
|
export default Grid;
|