Skip to content

Commit

Permalink
Merge pull request #293 from ZWkang/hotfix/grid-item-click-event
Browse files Browse the repository at this point in the history
feat(grid-item): explore grid-item to pass props
  • Loading branch information
LeeJim authored Oct 25, 2022
2 parents e208b7d + 2461845 commit feddd17
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/grid/GridItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ const getGridItemWidth = (column: number) => `${100 / column}%`;
export interface GridItemProp extends TdGridItemProps, TdGridProps {}

const GridItem: FC<GridItemProp> = (prop) => {
const { description, image, layout, text, badgeProps } = prop;
const { description, image, layout, text, badgeProps, ...resetProps } = prop;

const { classPrefix } = useConfig();
const { align, gutter, column, border } = useContext(GridContext);

const name = `${classPrefix}-grid-item`;

const rootClass = useMemo(() => cls(name, {
[`${name}--bordered`]: border,
[`${classPrefix}-is-large`]: column <= 3,
}), [border, name, column, classPrefix]);
const rootClass = useMemo(
() =>
cls(name, {
[`${name}--bordered`]: border,
[`${classPrefix}-is-large`]: column <= 3,
}),
[border, name, column, classPrefix],
);

const isHorizontal = useMemo(() => layout === 'horizontal', [layout]);

Expand Down Expand Up @@ -96,7 +100,7 @@ const GridItem: FC<GridItemProp> = (prop) => {
);

return (
<div className={rootClass} style={rootStyle}>
<div {...resetProps} className={rootClass} style={rootStyle}>
{badgeProps ? <Badge {...badgeProps}>{gridItemImage}</Badge> : gridItemImage}
<div className={`${name}__text`} style={textStyle}>
<div className={`${name}__title`} style={titleStyle}>
Expand Down

0 comments on commit feddd17

Please sign in to comment.