Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ui-component-library / src / playground / Image / deps / fromProps.ts
Size: Mime:
// import { getWidthHeight } from './getWidthHeight'
// // import { calculateAspectRatio } from './calculateAspectRatio'
// // import { toPlaceholder } from './toPlaceholder'
import { isImageLike } from './isImage'
import { toSecureProtocol } from 'uxui-modules/utils/toSecureProtocol'

// eslint-disable-next-line
export const fromPropsToSrc = props => {
  const alt = props.alt || ''
  let src = props.src || ''

  if (isImageLike(alt)) {
    src = alt
  }

  const url =
    src || alt || props.src || props.imageSrc || props.url || props.value || props.imageSource

  return toSecureProtocol(url)
}

export const fromPropsToAlt = props =>
  props.caption || props.text || props.alternateImage || props.label || props.alt