design-react-kit
Version:
Componenti React per Bootstrap 5
1 lines • 2.41 kB
Source Map (JSON)
{"version":3,"sources":["../../src/ResponsiveImage/ResponsiveImage.tsx"],"sourcesContent":["import React, { FC, HTMLAttributes } from 'react';\n\nexport interface ResponsiveImageProps extends HTMLAttributes<HTMLImageElement> {\n /** Un testo alternativo per descrivere l'immagine mostrata */\n alt: string;\n /** L'URI dell'immagine da mostrare */\n src: string;\n /** Il titolo dell'immagine */\n title?: string;\n testId?: string;\n /** Indica se l'immagine deve essere considerata proporzionata */\n proportioned?: boolean;\n}\n\nexport const ResponsiveImage: FC<ResponsiveImageProps> = ({\n alt,\n testId,\n proportioned = false,\n children,\n ...attributes\n}) => {\n if (children) {\n if (proportioned) {\n return (\n <div className='img-responsive-wrapper'>\n <div className='img-responsive'>\n <figure className='img-wrapper'>\n <img {...attributes} alt={alt} className='figure-img img-fluid rounded' />\n {children}\n </figure>\n </div>\n </div>\n );\n } else {\n return (\n <figure className='figure img-full w-100 img-responsive-wrapper'>\n <img {...attributes} alt={alt} className='figure-img img-fluid rounded' />\n {children}\n </figure>\n );\n }\n } else {\n return (\n <div className='img-responsive-wrapper' data-testid={testId}>\n <div className='img-responsive'>\n <div className='img-wrapper'>\n <img {...attributes} alt={alt} />\n </div>\n </div>\n </div>\n );\n }\n};\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA0C,sBAc7BF,EAA4C,CAAC,CACxD,IAAAG,EACA,OAAAC,EACA,aAAAC,EAAe,GACf,SAAAC,EACA,GAAGC,CACL,IACMD,EACED,EAEA,EAAAG,QAAA,cAAC,OAAI,UAAU,0BACb,EAAAA,QAAA,cAAC,OAAI,UAAU,kBACb,EAAAA,QAAA,cAAC,UAAO,UAAU,eAChB,EAAAA,QAAA,cAAC,OAAK,GAAGD,EAAY,IAAKJ,EAAK,UAAU,+BAA+B,EACvEG,CACH,CACF,CACF,EAIA,EAAAE,QAAA,cAAC,UAAO,UAAU,gDAChB,EAAAA,QAAA,cAAC,OAAK,GAAGD,EAAY,IAAKJ,EAAK,UAAU,+BAA+B,EACvEG,CACH,EAKF,EAAAE,QAAA,cAAC,OAAI,UAAU,yBAAyB,cAAaJ,GACnD,EAAAI,QAAA,cAAC,OAAI,UAAU,kBACb,EAAAA,QAAA,cAAC,OAAI,UAAU,eACb,EAAAA,QAAA,cAAC,OAAK,GAAGD,EAAY,IAAKJ,EAAK,CACjC,CACF,CACF","names":["ResponsiveImage_exports","__export","ResponsiveImage","__toCommonJS","import_react","alt","testId","proportioned","children","attributes","React"]}