Skip to content

Commit 258fc2f

Browse files
committed
Added loading prop to img
1 parent a621ce3 commit 258fc2f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/react/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ export type PictureCommonProps = {
77
alt: string;
88
className?: string;
99
testId?: string;
10+
loading?: 'eager' | 'lazy';
1011
};
1112

1213
export type PictureProps = {
1314
sources: BreakpointSource[];
1415
} & PictureCommonProps;
1516

16-
export const Picture: React.FC<PictureProps> = ({ sources, alt, className, testId }) => {
17+
export const Picture: React.FC<PictureProps> = ({ sources, alt, className, testId, loading }) => {
1718
const lastSource = sources[sources.length - 1];
1819
const fallbackSrcSet = lastSource.srcSets[lastSource.srcSets.length - 1].srcSet;
1920

@@ -34,6 +35,7 @@ export const Picture: React.FC<PictureProps> = ({ sources, alt, className, testI
3435
src={fallbackSrcSet['1x']}
3536
data-testid={testId}
3637
alt={alt}
38+
loading={loading}
3739
/>
3840
</picture>
3941
);

0 commit comments

Comments
 (0)