Skip to content

Commit 0ba748d

Browse files
committed
Ajoute nativeImgProps pour les Card
1 parent 137c8a6 commit 0ba748d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Card.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import React, { memo, forwardRef, type ReactNode, type CSSProperties } from "react";
1+
import React, {
2+
memo,
3+
forwardRef,
4+
type ReactNode,
5+
type CSSProperties,
6+
DetailedHTMLProps,
7+
ImgHTMLAttributes
8+
} from "react";
29
import { symToStr } from "tsafe/symToStr";
310
import { assert } from "tsafe/assert";
411
import type { Equals } from "tsafe";
@@ -88,20 +95,23 @@ export namespace CardProps {
8895
imageUrl: string;
8996
imageAlt: string;
9097
imageComponent?: never;
98+
nativeImgProps?: DetailedHTMLProps<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
9199
};
92100

93101
export type WithImageComponent = {
94102
badge?: ReactNode;
95103
imageUrl?: never;
96104
imageAlt?: never;
97105
imageComponent: ReactNode;
106+
nativeImgProps?: never;
98107
};
99108

100109
export type WithoutImage = {
101110
badge?: never;
102111
imageUrl?: never;
103112
imageAlt?: never;
104113
imageComponent?: never;
114+
nativeImgProps?: never;
105115
};
106116
}
107117

@@ -118,6 +128,7 @@ export const Card = memo(
118128
imageUrl,
119129
imageAlt,
120130
imageComponent,
131+
nativeImgProps,
121132
start,
122133
detail,
123134
end,
@@ -227,6 +238,7 @@ export const Card = memo(
227238
className={cx(fr.cx("fr-responsive-img"), classes.imgTag)}
228239
src={imageUrl}
229240
alt={imageAlt}
241+
{...nativeImgProps}
230242
/>
231243
</div>
232244
{badge !== undefined && (

0 commit comments

Comments
 (0)