Skip to content

Commit

Permalink
fix(suite): Fix Card frame props (#14498)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvaclavik committed Sep 24, 2024
1 parent 383ceb8 commit 7826b23
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions packages/components/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,24 @@ const CardContainer = styled.div<
${withFrameProps}
`;

export type CardProps = AllowedFrameProps &
AccessibilityProps & {
paddingType?: PaddingType;
onMouseEnter?: HTMLAttributes<HTMLDivElement>['onMouseEnter'];
onMouseLeave?: HTMLAttributes<HTMLDivElement>['onMouseLeave'];
onClick?: HTMLAttributes<HTMLDivElement>['onClick'];
children?: ReactNode;
className?: string;
label?: ReactNode;
forceElevation?: Elevation;
};
type CommonCardProps = AccessibilityProps & {
paddingType?: PaddingType;
onMouseEnter?: HTMLAttributes<HTMLDivElement>['onMouseEnter'];
onMouseLeave?: HTMLAttributes<HTMLDivElement>['onMouseLeave'];
onClick?: HTMLAttributes<HTMLDivElement>['onClick'];
children?: ReactNode;
className?: string;
label?: ReactNode;
forceElevation?: Elevation;
};

const CardComponent = forwardRef<HTMLDivElement, CardProps & { $paddingType: PaddingType }>(
export type CardPropsWithTransientProps = CommonCardProps & TransientProps<AllowedFrameProps>;
export type CardProps = CommonCardProps & AllowedFrameProps;

const CardComponent = forwardRef<
HTMLDivElement,
CardPropsWithTransientProps & { $paddingType: PaddingType }
>(
(
{
children,
Expand All @@ -129,6 +134,7 @@ const CardComponent = forwardRef<HTMLDivElement, CardProps & { $paddingType: Pad
onMouseLeave,
className,
tabIndex,
...rest
},
ref,
) => {
Expand All @@ -145,6 +151,7 @@ const CardComponent = forwardRef<HTMLDivElement, CardProps & { $paddingType: Pad
className={className}
onMouseLeave={onMouseLeave}
{...withAccessibilityProps({ tabIndex })}
{...rest}
>
<ElevationContext baseElevation={elevation}>{children}</ElevationContext>
</CardContainer>
Expand Down

0 comments on commit 7826b23

Please sign in to comment.