@@ -7,23 +7,37 @@ interface TextImageBoxProps {
77 altText ?: string ;
88}
99
10+ const TextImage : React . FC < Pick < TextImageBoxProps , 'imageUrl' | 'altText' > > = ( { imageUrl, altText = "Image" } ) => {
11+ return (
12+ < div className = "w-full sm:flex flex-shrink-0 justify-center md:block md:w-1/4 mx-4 mb-0 lg:mb-4" >
13+ < img src = { `${ imageUrl } ` } alt = { altText } className = "w-full max-w-[250px] md:max-w-[200px] mx-auto justify-center rounded" />
14+ </ div >
15+ )
16+ } ;
17+
18+ /*
19+ * A component that displays a text box with an image on the left or right.
20+ *
21+ * @param imageUrl The URL of the image to display.
22+ * @param children The content to display in the text box.
23+ * @param imageOnRight Whether to display the image on the right side of the text box.
24+ * @param altText The alt text for the image.
25+ */
1026const TextImageBox : React . FC < TextImageBoxProps > = ( { imageUrl, children, imageOnRight = false , altText = "Image" } ) => {
1127return (
12- < div className = "flex flex-col sm :flex-row text-text text-lg items-start pt-5" >
28+ < div className = "flex flex-col md :flex-row text-text text-lg items-center md: items-start pt-5" >
1329 { ! imageOnRight && imageUrl && (
14- < div className = "flex-shrink-0 hidden md:block w-1/4 ml-4 mb-0 lg:mb-4" >
15- < img src = { `${ imageUrl } ` } alt = { altText } className = "w-full max-w-[200px] h-auto rounded" />
16- </ div >
30+ < TextImage imageUrl = { imageUrl } altText = { altText } />
1731 ) }
18- < div className = "flex-1 flex-col justify-between " >
32+ < div className = "flex flex -1 flex-col items-start justify-start " >
1933 { children }
2034 </ div >
2135 { imageOnRight && imageUrl && (
22- < div className = "flex-shrink-0 hidden md:block w-1/4 ml-4 mb-0 lg:mb-4 mr-0" >
23- < img src = { `${ imageUrl } ` } alt = { altText } className = "w-full max-w-[200px] h-auto rounded" />
24- </ div >
36+ < TextImage imageUrl = { imageUrl } altText = { altText } />
2537 ) }
2638 </ div > )
2739} ;
2840
41+
42+
2943export default TextImageBox ;
0 commit comments