diff --git a/packages/ffe-cards-react/src/CardBase.tsx b/packages/ffe-cards-react/src/CardBase.tsx index 0d6a2b0a29..f6a5e22652 100644 --- a/packages/ffe-cards-react/src/CardBase.tsx +++ b/packages/ffe-cards-react/src/CardBase.tsx @@ -36,10 +36,6 @@ function CardBaseWithForwardRef( ...rest } = props; - const withCardActionProps: React.ComponentProps = { - ...rest, - }; - return ( ( 'ffe-card-base--text-center': textCenter, 'ffe-card-base--no-padding': noPadding, })} - {...withCardActionProps} + {...(rest as React.ComponentPropsWithoutRef)} ref={ref} > {({ CardAction }) => diff --git a/packages/ffe-cards-react/src/IconCard/IconCard.tsx b/packages/ffe-cards-react/src/IconCard/IconCard.tsx index c748ec402f..a609357c67 100644 --- a/packages/ffe-cards-react/src/IconCard/IconCard.tsx +++ b/packages/ffe-cards-react/src/IconCard/IconCard.tsx @@ -22,9 +22,6 @@ function IconCardWithForwardRef( ref: ForwardedRef, ) { const { className, condensed, icon, children, ...rest } = props; - const withCardActionProps: React.ComponentProps = { - ...rest, - }; return ( ( { 'ffe-icon-card--condensed': condensed }, className, )} - {...withCardActionProps} + {...(rest as React.ComponentPropsWithoutRef)} ref={ref} > {({ CardAction }) => ( diff --git a/packages/ffe-cards-react/src/ImageCard/ImageCard.tsx b/packages/ffe-cards-react/src/ImageCard/ImageCard.tsx index 4ced30a300..5ddacfd0e1 100644 --- a/packages/ffe-cards-react/src/ImageCard/ImageCard.tsx +++ b/packages/ffe-cards-react/src/ImageCard/ImageCard.tsx @@ -22,13 +22,11 @@ function ImageCardWithForwardRef( ref: ForwardedRef, ) { const { className, imageSrc, imageAltText, children, ...rest } = props; - const withCardActionProps: React.ComponentProps = { - ...rest, - }; + return ( )} ref={ref} > {({ CardAction }) => ( diff --git a/packages/ffe-cards-react/src/StippledCard/StippledCard.tsx b/packages/ffe-cards-react/src/StippledCard/StippledCard.tsx index d8bb23e99c..e426ac49bc 100644 --- a/packages/ffe-cards-react/src/StippledCard/StippledCard.tsx +++ b/packages/ffe-cards-react/src/StippledCard/StippledCard.tsx @@ -25,9 +25,7 @@ function StippledCardWithForwardRef( ref: ForwardedRef, ) { const { className, condensed, img, children, ...rest } = props; - const withCardActionProps: React.ComponentProps = { - ...rest, - }; + return ( ( { 'ffe-stippled-card--condensed': condensed }, className, )} - {...withCardActionProps} + {...(rest as React.ComponentPropsWithoutRef)} ref={ref} > {({ CardAction }) => ( diff --git a/packages/ffe-cards-react/src/TextCard/TextCard.tsx b/packages/ffe-cards-react/src/TextCard/TextCard.tsx index 3eb9c1c042..02bc2ed733 100644 --- a/packages/ffe-cards-react/src/TextCard/TextCard.tsx +++ b/packages/ffe-cards-react/src/TextCard/TextCard.tsx @@ -22,10 +22,6 @@ function TextCardWithForwardRef( ) { const { className, leftAlign, children, ...rest } = props; - const withCardActionProps: React.ComponentProps = { - ...rest, - }; - return ( ( { 'ffe-text-card--left-align': leftAlign }, className, )} - {...withCardActionProps} + {...(rest as React.ComponentPropsWithoutRef)} ref={ref} > {({ CardAction }) =>