UNPKG

office-ui-fabric-react

Version:

Reusable React components for building experiences for Office 365.

110 lines 3.92 kB
import { AnimationClassNames, getGlobalClassNames } from '../../Styling'; var GlobalClassNames = { root: 'ms-Image', rootMaximizeFrame: 'ms-Image--maximizeFrame', image: 'ms-Image-image', imageCenter: 'ms-Image-image--center', imageContain: 'ms-Image-image--contain', imageCover: 'ms-Image-image--cover', imageNone: 'ms-Image-image--none', imageLandscape: 'ms-Image-image--landscape', imagePortrait: 'ms-Image-image--portrait' }; export var getStyles = function (props) { var className = props.className, width = props.width, height = props.height, maximizeFrame = props.maximizeFrame, isLoaded = props.isLoaded, shouldFadeIn = props.shouldFadeIn, shouldStartVisible = props.shouldStartVisible, isLandscape = props.isLandscape, isCenter = props.isCenter, isContain = props.isContain, isCover = props.isCover, isNone = props.isNone, isError = props.isError, isNotImageFit = props.isNotImageFit, theme = props.theme; var classNames = getGlobalClassNames(GlobalClassNames, theme); var ImageFitStyles = { position: 'absolute', left: '50% /* @noflip */', top: '50%', transform: 'translate(-50%,-50%)' // @todo test RTL renders transform: translate(50%,-50%); }; return { root: [ classNames.root, { overflow: 'hidden' }, maximizeFrame && [ classNames.rootMaximizeFrame, { height: '100%', width: '100%' } ], (isCenter || isContain || isCover) && { position: 'relative' }, className ], image: [ classNames.image, { display: 'block', opacity: 0 }, isLoaded && [ 'is-loaded', { opacity: 1 } ], isCenter && [classNames.imageCenter, ImageFitStyles], isContain && [ classNames.imageContain, isLandscape && { width: '100%', height: 'auto' }, !isLandscape && { width: 'auto', height: '100%' }, ImageFitStyles ], isCover && [ classNames.imageCover, isLandscape && { width: 'auto', height: '100%' }, !isLandscape && { width: '100%', height: 'auto' }, ImageFitStyles ], isNone && [ classNames.imageNone, { width: 'auto', height: 'auto' } ], isNotImageFit && [ !!width && !height && { height: 'auto', width: '100%' }, !width && !!height && { height: '100%', width: 'auto' }, !!width && !!height && { height: '100%', width: '100%' } ], isLoaded && shouldFadeIn && !shouldStartVisible && AnimationClassNames.fadeIn400, isLandscape && classNames.imageLandscape, !isLandscape && classNames.imagePortrait, !isLoaded && 'is-notLoaded', shouldFadeIn && 'is-fadeIn', isError && 'is-error' ] }; }; //# sourceMappingURL=Image.styles.js.map