Sha256: 9a76ff14d58051b6a58ef8fd2c91d0817500351364d1d01aecdbf3bdba013f6e
Contents?: true
Size: 1.4 KB
Versions: 506
Compression:
Stored size: 1.4 KB
Contents
import React from 'react' import classnames from 'classnames' import { GlobalProps, globalProps } from '../utilities/globalProps' import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props' type ImageType = { alt?: string, aria?: {[key: string]: string}, className?: string, data?: {[key: string]: string}, htmlOptions?: {[key: string]: string | number | boolean | (() => void)}, id?: string, onError?: () => void, size?: "xs" | "sm" | "md" | "lg" | "xl", rounded?: boolean, transition?: "blur" | "fade" | "scale", url?: string, } & GlobalProps const Image = (props: ImageType): React.ReactElement => { const { alt = '', aria = {}, className, data = {}, htmlOptions = {}, id, onError = null, rounded = false, size = '', transition = 'fade', url = '', } = props const ariaProps = buildAriaProps(aria) const classes = classnames( buildCss('pb_image_kit', size ? `size_${size}` : null), 'lazyload', transition, { rounded }, globalProps(props), className ) const dataProps = buildDataProps(data) const htmlProps = buildHtmlProps(htmlOptions) return ( <img {...ariaProps} {...dataProps} {...htmlProps} alt={alt} className={classes} data-src={url} id={id} onError={onError} src={url} /> ) } export default Image
Version data entries
506 entries across 506 versions & 1 rubygems