2017-07-07 13:36:54 +08:00
|
|
|
import classNames from 'classnames';
|
2023-05-06 15:49:37 +08:00
|
|
|
import * as React from 'react';
|
2022-12-25 18:34:42 +08:00
|
|
|
import { ConfigContext } from '../config-provider';
|
2022-05-07 14:31:54 +08:00
|
|
|
import type { ConfigConsumerProps } 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
|
|
|
}
|
|
|
|
|
2022-12-25 18:34:42 +08:00
|
|
|
const Grid: React.FC<CardGridProps> = ({ prefixCls, className, hoverable = true, ...props }) => {
|
|
|
|
const { getPrefixCls } = React.useContext<ConfigConsumerProps>(ConfigContext);
|
|
|
|
const prefix = getPrefixCls('card', prefixCls);
|
|
|
|
const classString = classNames(`${prefix}-grid`, className, {
|
|
|
|
[`${prefix}-grid-hoverable`]: hoverable,
|
|
|
|
});
|
|
|
|
return <div {...props} className={classString} />;
|
|
|
|
};
|
2019-02-19 13:37:38 +08:00
|
|
|
|
|
|
|
export default Grid;
|