File tree Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Expand file tree Collapse file tree 4 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ import styled from 'styled-components';
2
2
3
3
import { ImageObjectFitType , ImageStylesPropsType } from './types' ;
4
4
5
+ export const ImageStyled = styled . img `` ;
6
+
5
7
export const ImagePictureStyled = styled . picture < ImageStylesPropsType > `
6
8
position: relative;
7
9
display: inline-block;
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
3
+ import { useGenericComponents } from '@/provider/genericComponents' ;
4
+
3
5
import { ImageStandAlone } from './imageStandAlone' ;
4
6
import type { IImage } from './types' ;
5
7
6
8
const ImageComponent = (
7
9
props : IImage ,
8
10
ref : React . ForwardedRef < HTMLElement > | undefined | null
9
11
) : JSX . Element => {
10
- return < ImageStandAlone { ...props } ref = { ref } /> ;
12
+ const { IMAGE : GenericImageType } = useGenericComponents ( ) ;
13
+ return < ImageStandAlone { ...props } ref = { ref } component = { GenericImageType } /> ;
11
14
} ;
12
15
13
16
/**
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
2
3
+ import { ROLES } from '@/types' ;
3
4
import { DeviceBreakpointsType } from '@/types/breakpoints' ;
4
5
5
6
// internal components
6
7
import { PictureSourceStandAlone } from './components/pictureSourceStandAlone' ;
7
8
// styles
8
- import { ImagePictureStyled } from './image.styled' ;
9
+ import { ImagePictureStyled , ImageStyled } from './image.styled' ;
9
10
import { IImageStandAlone , ImageLoadingType } from './types' ;
10
11
import { getFallbackRatio } from './utils/getFallbackRatio' ;
11
12
@@ -25,8 +26,9 @@ const ImageStandAloneComponent = (
25
26
< PictureSourceStandAlone mediaSource = { props . images [ DeviceBreakpointsType . DESKTOP ] } />
26
27
< PictureSourceStandAlone mediaSource = { props . images [ DeviceBreakpointsType . TABLET ] } />
27
28
< PictureSourceStandAlone mediaSource = { props . images [ DeviceBreakpointsType . MOBILE ] } />
28
- < img
29
+ < ImageStyled
29
30
alt = { props . alt }
31
+ as = { props . component || ROLES . IMG }
30
32
height = { props . height }
31
33
loading = { loading }
32
34
src = { props . images . DEFAULT . src }
Original file line number Diff line number Diff line change
1
+ import { GenericImageType } from '@/provider/genericComponents' ;
1
2
import { DeviceBreakpointsType } from '@/types/breakpoints' ;
2
3
3
4
import { ImageLoadingType } from './loading' ;
@@ -23,6 +24,7 @@ export interface IImageStandAlone {
23
24
dataTestId ?: string ;
24
25
borderRadius ?: string ;
25
26
objectFit ?: ImageObjectFitType ;
27
+ component ?: GenericImageType ;
26
28
}
27
29
28
30
export type IImage = IImageStandAlone ;
You can’t perform that action at this time.
0 commit comments